irongit

A Neovim plugin enabling you to solve LeetCode problems.

119 lines2.3 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---| "html"
23---| "pythonml"
24---| "react"
25---| "vanillajs"
26
27---@alias lc.hook
28---| "LeetEnter"
29---| "LeetQuestionNew"
30
31---@alias lc.size
32---| string
33---| number
34---| { width: string | number, height: string | number }
35
36---@alias lc.position "top" | "right" | "bottom" | "left"
37
38---@alias lc.direction "col" | "row"
39
40---@alias lc.inject { before?: string|string[], after?: string|string[] }
41
42---@class lc.UserConfig
43local M = {
44 ---@type string
45 arg = "leetcode.nvim",
46
47 ---@type lc.lang
48 lang = "cpp",
49
50 cn = { -- leetcode.cn
51 enabled = false, ---@type boolean
52 translator = true, ---@type boolean
53 translate_problems = true, ---@type boolean
54 },
55
56 ---@type string
57 directory = vim.fn.stdpath("data") .. "/leetcode/",
58
59 ---@type boolean
60 logging = true,
61
62 cache = {
63 update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days
64 },
65
66 console = {
67 open_on_runcode = true, ---@type boolean
68
69 dir = "row", ---@type lc.direction
70
71 size = { ---@type lc.size
72 width = "90%",
73 height = "75%",
74 },
75
76 result = {
77 size = "60%", ---@type lc.size
78 },
79
80 testcase = {
81 virt_text = true, ---@type boolean
82
83 size = "40%", ---@type lc.size
84 },
85 },
86
87 description = {
88 position = "left", ---@type lc.position
89
90 width = "40%", ---@type lc.size
91
92 show_stats = true, ---@type boolean
93 },
94
95 hooks = {
96 ---@type fun()[]
97 LeetEnter = {},
98
99 ---@type fun(question: lc.ui.Question)[]
100 LeetQuestionNew = {},
101 },
102
103 ---@type boolean
104 image_support = false, -- setting this to `true` will disable question description wrap
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 injector = {} ---@type table<lc.lang, lc.inject>
117}
118
119return M