A Neovim plugin enabling you to solve LeetCode problems.
| 1 | local Object = require("nui.object") |
| 2 | |
| 3 | ---@class lc.ui.opts |
| 4 | ---@field padding? lc.ui.padding |
| 5 | ---@field spacing? integer |
| 6 | ---@field position? lc.ui.position |
| 7 | ---@field hl? string |
| 8 | ---@field on_press? function |
| 9 | ---@field sc? string |
| 10 | |
| 11 | ---@class lc.ui.Opts |
| 12 | ---@field opts lc.ui.opts |
| 13 | local Opts = Object("LeetOpts") |
| 14 | |
| 15 | -- |
| 16 | local pad = vim.deepcopy(self.opts.padding) |
| 17 | self.opts.padding = {} |
| 18 | return pad |
| 19 | end |
| 20 | |
| 21 | -- |
| 22 | local spacing = self.opts.spacing |
| 23 | self.opts.spacing = nil |
| 24 | return spacing |
| 25 | end |
| 26 | |
| 27 | -- |
| 28 | self.opts = vim.tbl_deep_extend("keep", self.opts, opts or {}) |
| 29 | |
| 30 | return self |
| 31 | end |
| 32 | |
| 33 | |
| 34 | self.opts = vim.tbl_deep_extend("force", self.opts, opts) |
| 35 | end |
| 36 | |
| 37 | |
| 38 | return self.opts |
| 39 | end |
| 40 | |
| 41 | -- |
| 42 | self.opts = vim.tbl_deep_extend("force", { |
| 43 | padding = {}, |
| 44 | }, vim.deepcopy(opts) or {}) |
| 45 | end |
| 46 | |
| 47 | ---@type fun(opts: table): lc.ui.Opts |
| 48 | local LeetOpts = Opts |
| 49 | |
| 50 | return LeetOpts |