irongit

A Neovim plugin enabling you to solve LeetCode problems.

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