irongit

A Neovim plugin enabling you to solve LeetCode problems.

54 lines998 BLua
1local NuiLayout = require("nui.layout")
2
3local log = require("leetcode.logger")
4
5---@class lc.ui.Layout : NuiLayout
6---@field visible boolean
7local Layout = NuiLayout:extend("LeetLayout")
8
9function Layout:show()
10 if not self._.mounted then
11 self:mount()
12 elseif not self.visible then
13 Layout.super.show(self)
14 end
15
16 self.visible = true
17end
18
19function Layout:hide()
20 if not self.visible then
21 return
22 end
23 Layout.super.hide(self)
24 self.visible = false
25end
26
27function Layout:toggle()
28 if not self.visible then
29 self:show()
30 else
31 self:hide()
32 end
33end
34
35function Layout:mount()
36 Layout.super.mount(self)
37 self.visible = true
38end
39
40function Layout:unmount()
41 Layout.super.unmount(self)
42 self.visible = false
43end
44
45function Layout:init(options, box) --
46 Layout.super.init(self, options, box)
47
48 self.visible = false
49end
50
51---@type fun(options: table, box: table): lc.ui.Renderer
52local LeetLayout = Layout
53
54return LeetLayout