irongit

A Neovim plugin enabling you to solve LeetCode problems.

120 lines2.4 KBLua
1---@alias lc.lang
2---| "cpp"
3---| "java"
4---| "python"
5---| "python3"
6---| "c"
7---| "csharp"
8---| "javascript"
9---| "typescript"
10---| "php"
11---| "swift"
12---| "kotlin"
13---| "dart"
14---| "golang"
15---| "ruby"
16---| "scala"
17---| "rust"
18---| "racket"
19---| "erlang"
20---| "elixir"
21---| "bash"
22
23---@alias lc.hook
24---| "LeetEnter"
25---| "LeetQuestionNew"
26
27---@alias lc.size
28---| string
29---| number
30---| { width: string | number, height: string | number }
31
32---@alias lc.position "top" | "right" | "bottom" | "left"
33
34---@alias lc.direction "col" | "row"
35
36---@alias lc.inject { before?: string|string[], after?: string|string[] }
37
38---@alias lc.storage table<"cache"|"home", string>
39
40---@class lc.UserConfig
41local M = {
42 ---@type string
43 arg = "leetcode.nvim",
44
45 ---@type lc.lang
46 lang = "cpp",
47
48 cn = { -- leetcode.cn
49 enabled = false, ---@type boolean
50 translator = true, ---@type boolean
51 translate_problems = true, ---@type boolean
52 },
53
54 ---@type lc.storage
55 storage = {
56 home = vim.fn.stdpath("data") .. "/leetcode",
57 cache = vim.fn.stdpath("cache") .. "/leetcode",
58 },
59
60 ---@type boolean
61 logging = true,
62
63 injector = {}, ---@type table<lc.lang, lc.inject>
64
65 cache = {
66 update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days
67 },
68
69 console = {
70 open_on_runcode = true, ---@type boolean
71
72 dir = "row", ---@type lc.direction
73
74 size = { ---@type lc.size
75 width = "90%",
76 height = "75%",
77 },
78
79 result = {
80 size = "60%", ---@type lc.size
81 },
82
83 testcase = {
84 virt_text = true, ---@type boolean
85
86 size = "40%", ---@type lc.size
87 },
88 },
89
90 description = {
91 position = "left", ---@type lc.position
92
93 width = "40%", ---@type lc.size
94
95 show_stats = true, ---@type boolean
96 },
97
98 hooks = {
99 ---@type fun()[]
100 LeetEnter = {},
101
102 ---@type fun(question: lc.ui.Question)[]
103 LeetQuestionNew = {},
104 },
105
106 keys = {
107 toggle = { "q", "<Esc>" }, ---@type string|string[]
108 confirm = { "<CR>" }, ---@type string|string[]
109
110 reset_testcases = "r", ---@type string
111 use_testcase = "U", ---@type string
112 focus_testcases = "H", ---@type string
113 focus_result = "L", ---@type string
114 },
115
116 ---@type boolean
117 image_support = false, -- setting this to `true` will disable question description wrap
118}
119
120return M