A Neovim plugin enabling you to solve LeetCode problems.
| 1 | local Lines = require("leetcode-ui.lines") |
| 2 | local t = require("leetcode.translator") |
| 3 | |
| 4 | ---@class lc.ui.menu.Title : lc.ui.Lines |
| 5 | ---@field text lc.ui.Lines |
| 6 | local Title = Lines:extend("LeetMenuTitle") |
| 7 | |
| 8 | ---@param history string[] |
| 9 | ---@param str string |
| 10 | ---@param opts? any |
| 11 | |
| 12 | history = vim.tbl_map(t, history) |
| 13 | str = t(str) |
| 14 | |
| 15 | opts = vim.tbl_deep_extend("force", { |
| 16 | padding = { |
| 17 | top = 1, |
| 18 | }, |
| 19 | }, opts or {}) |
| 20 | |
| 21 | Title.super.init(self, {}, opts) |
| 22 | |
| 23 | for _, hist in ipairs(history) do |
| 24 | self:append(hist, "leetcode_alt") |
| 25 | self:append(" ", "leetcode_list") |
| 26 | end |
| 27 | self:append(str, "Function") |
| 28 | end |
| 29 | |
| 30 | ---@type fun(history: string[], str: string, opts?: any): lc.ui.menu.Title |
| 31 | local LeetMenuTitle = Title |
| 32 | |
| 33 | return LeetMenuTitle |