A Neovim plugin enabling you to solve LeetCode problems.
refactor: picker width/height
4 files changed, +10 -7
+3-2lua/leetcode/picker/language/snacks.lua
| @@ -19,7 +19,6 @@ return function(question, cb) | ||
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | picker.pick({ |
| 22 | - source = "select", | |
| 23 | 22 | items = finder_items, |
| 24 | 23 | format = function(item) |
| 25 | 24 | local ret = {} |
| @@ -36,8 +35,10 @@ return function(question, cb) | ||
| 36 | 35 | title = t("Available Languages"), |
| 37 | 36 | layout = { |
| 38 | 37 | preview = false, |
| 38 | + preset = "select", | |
| 39 | 39 | layout = { |
| 40 | - height = math.floor(math.min(vim.o.lines * 0.8 - 10, #items + 2) + 0.5), | |
| 40 | + height = language_picker.height, | |
| 41 | + width = language_picker.width, | |
| 41 | 42 | }, |
| 42 | 43 | }, |
| 43 | 44 | actions = { |
+1-1lua/leetcode/picker/question/init.lua
| @@ -9,7 +9,7 @@ local Picker = require("leetcode.picker") | ||
| 9 | 9 | local P = {} |
| 10 | 10 | |
| 11 | 11 | P.width = 100 |
| 12 | -P.height = 20 | |
| 12 | +P.height = 0.6 | |
| 13 | 13 | |
| 14 | 14 | ---@param items lc.cache.Question[] |
| 15 | 15 | ---@param opts table<string, string[]> |
+3-2lua/leetcode/picker/question/snacks.lua
| @@ -19,7 +19,6 @@ return function(questions, opts) | ||
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | picker.pick({ |
| 22 | - source = "select", | |
| 23 | 22 | items = finder_items, |
| 24 | 23 | format = function(item) |
| 25 | 24 | local ret = {} |
| @@ -35,9 +34,11 @@ return function(questions, opts) | ||
| 35 | 34 | end, |
| 36 | 35 | title = t("Select a Question"), |
| 37 | 36 | layout = { |
| 37 | + preset = "select", | |
| 38 | 38 | preview = false, |
| 39 | 39 | layout = { |
| 40 | - height = math.floor(math.min(vim.o.lines * 0.8 - 10, #items + 2) + 0.5), | |
| 40 | + height = question_picker.height, | |
| 41 | + width = question_picker.width, | |
| 41 | 42 | }, |
| 42 | 43 | }, |
| 43 | 44 | actions = { |
+3-2lua/leetcode/picker/tabs/snacks.lua
| @@ -21,7 +21,6 @@ return function(tabs) | ||
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | picker.pick({ |
| 24 | - source = "select", | |
| 25 | 24 | items = finder_items, |
| 26 | 25 | format = function(item) |
| 27 | 26 | local ret = {} |
| @@ -38,8 +37,10 @@ return function(tabs) | ||
| 38 | 37 | title = t("Select a Question"), |
| 39 | 38 | layout = { |
| 40 | 39 | preview = false, |
| 40 | + preset = "select", | |
| 41 | 41 | layout = { |
| 42 | - height = math.floor(math.min(vim.o.lines * 0.8 - 10, #items + 2) + 0.5), | |
| 42 | + height = tabs_picker.height, | |
| 43 | + width = tabs_picker.width, | |
| 43 | 44 | }, |
| 44 | 45 | }, |
| 45 | 46 | actions = { |