kawre / leetcode.nvim

A Neovim plugin enabling you to solve LeetCode problems.
MIT License
655 stars 34 forks source link

leetcode.cn cannot sign in #48

Closed Dusker233 closed 5 months ago

Dusker233 commented 5 months ago

image

Hello there. I'm always getting this error, and i have already set cn as enabled.

image

Kinda weird and i don't know what to do rn...

kawre commented 5 months ago

Can you try Leet cookie delete?

kawre commented 5 months ago

It should work now without deleting the cookie. Can you confirm?

Dusker233 commented 5 months ago

No, cannot work rn.

  1. I updated plugin.
  2. Sign in (By Cookie) -> session expired
  3. Leet cookie delete
  4. Sign in (By Cookie) -> session expired
  5. re sign-in leetcode.cn
  6. Sign in (By Cookie) -> session expired
Dusker233 commented 5 months ago

oh i fixed. previously i modified cn in ~/nvim/lua/plugins/leetcode.lua, now i modified cn in ~/nvim-data/lazy/leetcode.nvim/lua/leetcode/config/template.lua, now it works.

kawre commented 5 months ago

Can I see your configuration file for leetcode.nvim? You only modified the source code, so when I update this plugin the template.lua will get overridden.

Dusker233 commented 5 months ago

just like the pic above, i only modified cn->enabled=true, and nothing else.

here's my template.lua: https://paste.ubuntu.com/p/75vgSCpCh2/

here's my leetcode.lua: https://paste.ubuntu.com/p/6rykmm3qwH/

kawre commented 5 months ago
 opts = {
            ---@type string
            arg = "leetcode.nvim",

            ---@type lc.lang
            lang = "cpp",

            cn = { -- leetcode.cn
                enabled = false, ---@type boolean
                translator = true, ---@type boolean
                translate_problems = true, ---@type boolean
            },

            ---@type string
            directory = vim.fn.stdpath("data") .. "/leetcode/",

            ---@type boolean
            logging = true,

            injector = {}, ---@type table<lc.lang, lc.inject>

            cache = {
                update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days
            },

            console = {
                open_on_runcode = true, ---@type boolean

                dir = "row", ---@type lc.direction

                size = { ---@type lc.size
                    width = "90%",
                    height = "75%",
                },

                result = {
                    size = "60%", ---@type lc.size
                },

                testcase = {
                    virt_text = true, ---@type boolean

                    size = "40%", ---@type lc.size
                },
            },

            description = {
                position = "left", ---@type lc.position

                width = "40%", ---@type lc.size

                show_stats = true, ---@type boolean
            },

            hooks = {
                ---@type fun()[]
                LeetEnter = {},

                ---@type fun(question: lc.ui.Question)[]
                LeetQuestionNew = {},
            },

            keys = {
                toggle = { "q", "<Esc>" }, ---@type string|string[]
                confirm = { "<CR>" }, ---@type string|string[]

                reset_testcases = "r", ---@type string
                use_testcase = "U", ---@type string
                focus_testcases = "H", ---@type string
                focus_result = "L", ---@type string
            },

            ---@type boolean
            image_support = false, -- setting this to `true` will disable question description wrap
    },

opts don't apply because you have them nested in an additional table. Replace your opts with the ones i sent

kawre commented 5 months ago

and set cn.enabled to true

Dusker233 commented 5 months ago

yep it works. thx a lot!