A Neovim plugin enabling you to solve LeetCode problems.
fix(case): question not found
3 files changed, +5 -5
+3-3lua/leetcode-ui/group/case.lua
| @@ -55,11 +55,11 @@ end | ||
| 55 | 55 | ---@param passed boolean |
| 56 | 56 | --- |
| 57 | 57 | ---@return lc.ui.Case |
| 58 | -function Case:init(body, passed) | |
| 58 | +function Case:init(body, passed, question) | |
| 59 | 59 | Case.super.init(self, {}, { spacing = 1 }) |
| 60 | 60 | |
| 61 | 61 | self.body = body |
| 62 | - self.question = utils.curr_question() | |
| 62 | + self.question = question | |
| 63 | 63 | |
| 64 | 64 | self:insert(self:input(body.input)) |
| 65 | 65 | self:insert(self:output(body.output, body.expected)) |
| @@ -71,7 +71,7 @@ function Case:init(body, passed) | ||
| 71 | 71 | self.passed = passed |
| 72 | 72 | end |
| 73 | 73 | |
| 74 | ----@alias lc.Result.Case.constructor fun(body: case_body, passed: boolean): lc.ui.Case | |
| 74 | +---@alias lc.Result.Case.constructor fun(body: case_body, passed: boolean, question: lc.ui.Question): lc.ui.Case | |
| 75 | 75 | ---@type lc.Result.Case.constructor |
| 76 | 76 | local LeetCase = Case |
| 77 | 77 |
+1-1lua/leetcode-ui/group/cases.lua
| @@ -67,7 +67,7 @@ function Cases:init(item, parent) | ||
| 67 | 67 | output = item.code_answer[i], |
| 68 | 68 | expected = item.expected_code_answer[i], |
| 69 | 69 | std_output = item.std_output_list[i], |
| 70 | - }, item.compare_result:sub(i, i) == "1") | |
| 70 | + }, item.compare_result:sub(i, i) == "1", parent.question) | |
| 71 | 71 | end |
| 72 | 72 | |
| 73 | 73 | self:change(1) |
+1-1lua/leetcode-ui/renderer/result.lua
| @@ -130,7 +130,7 @@ function ResultLayout:handle_submission_error(item) -- status code = 11 | ||
| 130 | 130 | output = item.code_output, |
| 131 | 131 | expected = item.expected_output, |
| 132 | 132 | std_output = item.std_output, |
| 133 | - }, false)) | |
| 133 | + }, false, self.parent.question)) | |
| 134 | 134 | end |
| 135 | 135 | |
| 136 | 136 | ---@private |