irongit

A Neovim plugin enabling you to solve LeetCode problems.

142 lines2.9 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---| "enter"
25---| "question_enter"
26---| "leave"
27
28---@alias lc.size
29---| string
30---| number
31---| { width: string | number, height: string | number }
32
33---@alias lc.position "top" | "right" | "bottom" | "left"
34
35---@alias lc.direction "col" | "row"
36
37---@alias lc.inject { gap?: number, imports?: (fun(default_imports: string[]): string[])|string|string[], before?: string|string[], after?: string|string[] }
38
39---@alias lc.storage table<"cache"|"home", string>
40
41---@alias lc.picker { provider?: "fzf-lua" | "telescope" | "snacks-picker" }
42
43---@class lc.UserConfig
44local M = {
45 ---@type string
46 arg = "leetcode.nvim",
47
48 ---@type lc.lang
49 lang = "cpp",
50
51 cn = { -- leetcode.cn
52 enabled = false, ---@type boolean
53 translator = true, ---@type boolean
54 translate_problems = true, ---@type boolean
55 },
56
57 ---@type lc.storage
58 storage = {
59 home = vim.fn.stdpath("data") .. "/leetcode",
60 cache = vim.fn.stdpath("cache") .. "/leetcode",
61 },
62
63 ---@type table<string, boolean>
64 plugins = {
65 non_standalone = false,
66 },
67
68 ---@type boolean
69 logging = true,
70
71 injector = {}, ---@type table<lc.lang, lc.inject>
72
73 cache = {
74 update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days
75 },
76
77 editor = {
78 reset_previous_code = true, ---@type boolean
79 fold_imports = true, ---@type boolean
80 },
81
82 console = {
83 open_on_runcode = true, ---@type boolean
84
85 dir = "row", ---@type lc.direction
86
87 size = { ---@type lc.size
88 width = "90%",
89 height = "75%",
90 },
91
92 result = {
93 size = "60%", ---@type lc.size
94 },
95
96 testcase = {
97 virt_text = true, ---@type boolean
98
99 size = "40%", ---@type lc.size
100 },
101 },
102
103 description = {
104 position = "left", ---@type lc.position
105
106 width = "40%", ---@type lc.size
107
108 show_stats = true, ---@type boolean
109 },
110
111 ---@type lc.picker
112 picker = { provider = nil },
113
114 hooks = {
115 ---@type fun()[]
116 ["enter"] = {},
117
118 ---@type fun(question: lc.ui.Question)[]
119 ["question_enter"] = {},
120
121 ---@type fun()[]
122 ["leave"] = {},
123 },
124
125 keys = {
126 toggle = { "q" }, ---@type string|string[]
127 confirm = { "<CR>" }, ---@type string|string[]
128
129 reset_testcases = "r", ---@type string
130 use_testcase = "U", ---@type string
131 focus_testcases = "H", ---@type string
132 focus_result = "L", ---@type string
133 },
134
135 ---@type lc.highlights
136 theme = {},
137
138 ---@type boolean
139 image_support = false,
140}
141
142return M