irongit

A Neovim plugin enabling you to solve LeetCode problems.

122 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 plugins = {},
61
62 ---@type boolean
63 logging = true,
64
65 injector = {}, ---@type table<lc.lang, lc.inject>
66
67 cache = {
68 update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days
69 },
70
71 console = {
72 open_on_runcode = true, ---@type boolean
73
74 dir = "row", ---@type lc.direction
75
76 size = { ---@type lc.size
77 width = "90%",
78 height = "75%",
79 },
80
81 result = {
82 size = "60%", ---@type lc.size
83 },
84
85 testcase = {
86 virt_text = true, ---@type boolean
87
88 size = "40%", ---@type lc.size
89 },
90 },
91
92 description = {
93 position = "left", ---@type lc.position
94
95 width = "40%", ---@type lc.size
96
97 show_stats = true, ---@type boolean
98 },
99
100 hooks = {
101 ---@type fun()[]
102 LeetEnter = {},
103
104 ---@type fun(question: lc.ui.Question)[]
105 LeetQuestionNew = {},
106 },
107
108 keys = {
109 toggle = { "q", "<Esc>" }, ---@type string|string[]
110 confirm = { "<CR>" }, ---@type string|string[]
111
112 reset_testcases = "r", ---@type string
113 use_testcase = "U", ---@type string
114 focus_testcases = "H", ---@type string
115 focus_result = "L", ---@type string
116 },
117
118 ---@type boolean
119 image_support = false, -- setting this to `true` will disable question description wrap
120}
121
122return M