leetcode.nvim icon indicating copy to clipboard operation
leetcode.nvim copied to clipboard

Adding a new testcase doesn't stick

Open charlietlamb opened this issue 1 year ago • 4 comments

Whenever I submit a problem and add a new testcase, then run Leet test, the testcase I added does not appear in the testcases. This means that if I want to see that testcase I have to submit again. Using the most recent version with nvim on mac.

charlietlamb avatar Aug 16 '24 08:08 charlietlamb

Did you ever figure out how to add own testacases?

nxtkofi avatar Feb 18 '25 15:02 nxtkofi

Yes, by pressing U on the failed one

miklelappo avatar Oct 22 '25 21:10 miklelappo

@charlietlamb use :hide instead of :q and then testcase will stick.

Please see the difference in source code here:

function ConsoleLayout:unmount() --
    ConsoleLayout.super.unmount(self)

    self.testcase = Testcase(self)
    self.result = Result(self)
    self.popups = { self.testcase, self.result }
end

function ConsoleLayout:hide()
    ConsoleLayout.super.hide(self)

    pcall(function()
        local winid = vim.api.nvim_get_current_win()
        if winid == self.question.description.winid then
            vim.api.nvim_set_current_win(self.question.winid)
        end
    end)
end

miklelappo avatar Nov 09 '25 22:11 miklelappo

@nxtkofi to add testcases just switch the panel to the left and type them below

Image

miklelappo avatar Nov 09 '25 22:11 miklelappo