Skip to content

Commit b3ab6cb

Browse files
committed
fix(picker): filtering
1 parent 0b3710f commit b3ab6cb

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,13 @@ https://github.com/kawre/leetcode.nvim/assets/69250723/b7be8b95-5e2c-4153-8845-4
365365

366366
```lua
367367
local leet_arg = "leetcode.nvim"
368+
```
368369

369-
return {
370+
```lua
371+
{
370372
"kawre/leetcode.nvim",
371-
...
372373
lazy = leet_arg ~= vim.fn.argv()[1],
373-
opts = {
374-
arg = leet_arg,
375-
},
376-
...
374+
opts = { arg = leet_arg },
377375
}
378376
```
379377

README.zh.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,13 @@ https://github.com/kawre/leetcode.nvim/assets/69250723/b7be8b95-5e2c-4153-8845-4
367367

368368
```lua
369369
local leet_arg = "leetcode.nvim"
370+
```
370371

371-
return {
372+
```lua
373+
{
372374
"kawre/leetcode.nvim",
373-
...
374375
lazy = leet_arg ~= vim.fn.argv()[1],
375-
opts = {
376-
arg = leet_arg,
377-
},
378-
...
376+
opts = { arg = leet_arg },
379377
}
380378
```
381379

lua/leetcode-ui/popup/console/testcase.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local ConsolePopup = require("leetcode-ui.popup.console")
44
local t = require("leetcode.translator")
55

66
---@class lc.ui.Console.TestcasePopup : lc.ui.Console.Popup
7-
---@field testcases table<string[][]>
7+
---@field testcases table<string[]>
88
---@field extmarks integer[]
99
local Testcase = ConsolePopup:extend("LeetTestcasePopup")
1010

lua/leetcode/pickers/question.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ local function filter_questions(questions, opts)
104104

105105
---@param q lc.cache.Question
106106
return vim.tbl_filter(function(q)
107-
local flag = true
108-
if opts.difficulty then
109-
if not vim.tbl_contains(opts.difficulty, q.difficulty:lower()) then return false end
107+
local diff_flag = true
108+
if opts.difficulty and not vim.tbl_contains(opts.difficulty, q.difficulty:lower()) then
109+
diff_flag = false
110110
end
111111

112-
if opts.status then
113-
if not q.status then return true end
114-
if not vim.tbl_contains(opts.status, q.status) then return false end
112+
local status_flag = true
113+
if opts.status and not vim.tbl_contains(opts.status, q.status) then --
114+
status_flag = false
115115
end
116116

117-
return true
117+
return diff_flag and status_flag
118118
end, questions)
119119
end
120120

0 commit comments

Comments
 (0)