Skip to content

Commit 2dddc4f

Browse files
Fix typo and Create Luadoc (#1457)
* Fix typo * Create luadoc.lua Now you can use the LSP when setting up options, using `---@type LspsagaConfig`
1 parent 4e9d616 commit 2dddc4f

2 files changed

Lines changed: 223 additions & 1 deletion

File tree

lua/lspsaga/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ local default_config = {
124124
show_file = true,
125125
folder_level = 1,
126126
color_mode = true,
127-
dely = 300,
127+
delay = 300,
128128
},
129129
outline = {
130130
win_position = 'right',

lua/lspsaga/luadoc.lua

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
---@class LspsagaConfig
2+
---@field public ui? LspsagaConfig.Ui Global UI config
3+
---@field public hover? LspsagaConfig.Hover Hover documentation
4+
---@field public diagnostic? LspsagaConfig.Diagnostic LSP Diagnostic popup
5+
---@field public code_action? LspsagaConfig.CodeAction LSP Code Action popup
6+
---@field public lightbulb? LspsagaConfig.Lightbulb LSP Lightbulb indicator
7+
---@field public scroll_preview? LspsagaConfig.Scroll.Keys Keys to scroll
8+
---@field public request_timeout? integer LSP request timeout
9+
---@field public finder? LspsagaConfig.Finder Token/reference finder
10+
---@field public definition? LspsagaConfig.Definition Definition
11+
---@field public rename? LspsagaConfig.Rename Rename
12+
---@field public symbol_in_winbar? LspsagaConfig.Crumbs Breadcrumbs
13+
---@field public outline? LspsagaConfig.Outline Outline
14+
---@field public callhierarchy? LspsagaConfig.Hierarchy Call hierarchy
15+
---@field public typehierarchy? LspsagaConfig.Hierarchy Type hierarchy
16+
---@field public implement? LspsagaConfig.Implement Implementation
17+
---@field public beacon? LspsagaConfig.Beacon Beacon
18+
---@field public floaterm? LspsagaConfig.Term Floating terminal
19+
20+
21+
---@class LspsagaConfig.Definition
22+
---@field width? number defines float window width
23+
---@field height? number defines float window height
24+
---@field save_pos? boolean Saves cursor position
25+
---@field keys? LspsagaConfig.Definition.Keys
26+
27+
28+
---@class LspsagaConfig.Rename
29+
---@field in_select? boolean
30+
---@field auto_save? boolean
31+
---@field project_max_width? number
32+
---@field project_max_height? number
33+
---@field keys? LspsagaConfig.Rename.Keys
34+
35+
36+
---@class LspsagaConfig.Crumbs
37+
---@field enable? boolean Enable breadcrumbs
38+
---@field separator? string Separator symbol
39+
---@field hide_keyword? boolean when true some symbols like if and for; ignored if treesitter is not installed
40+
---@field ignore_patterns? string[] Filename patterns to ignore
41+
---@field show_file? boolean Show file name before symbols
42+
---@field folder_level? integer Show how many folder layers before the file name
43+
---@field color_mode? boolean mean the symbol name and icon have same color. Otherwise, symbol name is light-white
44+
---@field delay? integer Dynamic render delay
45+
46+
47+
---@class LspsagaConfig.Outline
48+
---@field win_position? "left" | "right" window position
49+
---@field win_width? integer window width
50+
---@field auto_preview? boolean auto preview when cursor moved in outline window
51+
---@field detail? boolean show detail
52+
---@field auto_close? boolean auto close itself when outline window is last window
53+
---@field close_after_jump? boolean close after jump
54+
---@field layout? LayoutOption when is float above options will ignored
55+
---@field max_height? number Max height of outline window
56+
---@field left_width? number Width of left panel
57+
---@field keys? LspsagaConfig.Outline.Keys
58+
59+
60+
---@class LspsagaConfig.Hierarchy
61+
---@field layout? LayoutOption
62+
---@field left_width? number Width of left panel
63+
---@field keys? LspsagaConfig.Hierarchy.Keys
64+
65+
66+
---@class LspsagaConfig.Implement
67+
---@field enable? boolean Enable implementation plugin
68+
---@field sign? boolean show sign in status column
69+
---@field lang? string[] Additional languages that support implementing interfaces
70+
---@field virtual_text? boolean show virtual text at the end of line
71+
---@field priority? integer sign priority
72+
73+
74+
---@class LspsagaConfig.Term
75+
---@field height? number Floating terminal height
76+
---@field width? number Floating terminal width
77+
78+
79+
---@class LspsagaConfig.Ui
80+
---@field border? BorderType Border type, see `:help nvim_open_win`
81+
---@field devicon? boolean Whether to use nvim-web-devicons
82+
---@field foldericon? boolean Show folder icon in breadcrumbs
83+
---@field title? boolean Show title in some float window
84+
---@field expand? string Expand (drop down) icon
85+
---@field collapse? string Collapse (drop down) icon
86+
---@field code_action? string Code Action (lightbulb) icon
87+
---@field lines? string[] Symbols used in virtual text connect
88+
---@field kind? table LSP kind custom table
89+
---@field button? [string, string] Button icon { '', '' }
90+
---@field imp_sign? string Implement icon
91+
92+
93+
---@class LspsagaConfig.Hover
94+
---@field max_width? number Defines float window width
95+
---@field max_height? number Defines float window height
96+
---@field open_link? string Key for opening links
97+
---@field open_cmd? string Cmd for opening links
98+
99+
100+
---@class LspsagaConfig.Diagnostic
101+
---@field show_layout? LayoutOption Config layout of diagnostic window not jump window
102+
---@field show_normal_height? integer Show window height when diagnostic show window layout is normal
103+
---@field jump_num_shortcut? boolean Enable number shortcuts to execute code action quickly
104+
---@field auto_preview? boolean Auto preview result after change
105+
---@field max_width? number Diagnostic jump window max width
106+
---@field max_height? number Diagnostic jump window max height
107+
---@field max_show_width? number Show window max width when layout is float
108+
---@field max_show_height? number Show window max height when layout is float
109+
---@field text_hl_follow? boolean Diagnostic jump window text highlight follow diagnostic type
110+
---@field border_follow? boolean Diagnostic jump window border highlight follow diagnostic type
111+
---@field wrap_long_lines? boolean Wrap long lines
112+
---@field extend_relatedInformation? boolean When have relatedInformation, diagnostic message is extended to show it
113+
---@field diagnostic_only_current? boolean Only show diagnostic virtual text on the current line
114+
---@field keys? LspsagaConfig.Diagnostic.Keys
115+
116+
117+
---@class LspsagaConfig.CodeAction
118+
---@field num_shortcut? boolean Enable number shortcuts to execute code action quickly
119+
---@field show_server_name? boolean show language server name
120+
---@field extend_gitsigns? boolean extend gitsigns plugin diff action
121+
---@field only_in_cursor? boolean only execute code action in current cursor position
122+
---@field max_height? number code action window max height
123+
---@field cursorline? boolean code action window highlight cursor line
124+
---@field keys? LspsagaConfig.CodeAction.Keys
125+
126+
127+
---@class LspsagaConfig.Lightbulb
128+
---@field enable? boolean enable lightbulb
129+
---@field sign? boolean show sign in status column
130+
---@field debounce? integer timer debounce
131+
---@field sign_priority? integer sign priority
132+
---@field virtual_text? boolean show virtual text at the end of line
133+
---@field enable_in_insert? boolean enable virtual text in insert mode
134+
135+
136+
---@class LspsagaConfig.Finder
137+
---@field max_height? number max_height of the finder window (float layout)
138+
---@field left_width? number width of left panel in finder window
139+
---@field methods? LspMethods
140+
---@field default? "ref" | "imp" | "def" | string Default search results shown; **ref**erences; **imp**lementation; **def**inition; any in config.methods
141+
---@field layout? LayoutOption
142+
---@field silent? boolean If its true, it will disable show the no response message
143+
---@field filter? string[] Filter search results
144+
---@field fname_sub? function Filename substitution function
145+
---@field sp_inexist? boolean
146+
---@field sp_global? boolean
147+
---@field ly_botright? boolean
148+
---@field keys? LspsagaConfig.Finder.Keys
149+
150+
151+
---@class LspsagaConfig.Beacon
152+
---@field enable? boolean Enable beacon
153+
---@field frequency? integer
154+
155+
156+
---@class LspsagaConfig.Scroll.Keys
157+
---@field scroll_down? SagaKeys
158+
---@field scroll_up? SagaKeys
159+
160+
161+
---@class LspsagaConfig.Diagnostic.Keys
162+
---@field exec_action? SagaKeys execute action (in jump window)
163+
---@field quit? SagaKeys quit key for the jump window
164+
---@field toggle_or_jump? SagaKeys toggle or jump to position when in `diagnostic_show` window
165+
---@field quit_in_show? SagaKeys quit key for the `diagnostic_show` window
166+
167+
168+
---@class LspsagaConfig.CodeAction.Keys
169+
---@field quit? SagaKeys quit the float window
170+
---@field exec? SagaKeys execute action
171+
172+
173+
---@class LspsagaConfig.Finder.Keys
174+
---@field shuttle? SagaKeys shuttle between the finder layout window
175+
---@field toggle_or_open? SagaKeys toggle expand or open
176+
---@field vsplit? SagaKeys open in vsplit
177+
---@field split? SagaKeys open in hsplit
178+
---@field tabe? SagaKeys open in tabe
179+
---@field tabnew? SagaKeys open in new tab
180+
---@field quit? SagaKeys quit the finder; only works in layout left window
181+
---@field close? SagaKeys close the finder
182+
183+
184+
---@class LspsagaConfig.Hierarchy.Keys
185+
---@field edit? SagaKeys
186+
---@field vsplit? SagaKeys open in vsplit
187+
---@field split? SagaKeys open in hsplit
188+
---@field tabe? SagaKeys open in tabe
189+
---@field quit? SagaKeys quit the hierarchy
190+
---@field shuttle? SagaKeys shuttle between the hierarchy
191+
---@field close? SagaKeys close the hierarchy
192+
---@field toggle_or_req? SagaKeys toggle or do request
193+
194+
195+
---@class LspsagaConfig.Outline.Keys
196+
---@field toggle_or_jump? SagaKeys toggle or jump
197+
---@field quit? SagaKeys quit
198+
---@field jump? SagaKeys jump to pos even on expand/collapse node
199+
200+
201+
---@class LspsagaConfig.Definition.Keys
202+
---@field edit? SagaKeys
203+
---@field vsplit? SagaKeys open in vsplit
204+
---@field split? SagaKeys open in hsplit
205+
---@field tabe? SagaKeys open in tabe
206+
---@field quit? SagaKeys quit the definition
207+
---@field close? SagaKeys close the definition
208+
209+
210+
---@class LspsagaConfig.Rename.Keys
211+
---@field quit? SagaKeys quit rename window or `project_replace` window
212+
---@field exec? SagaKeys execute rename in `rename` window or execute replace in `project_replace` window
213+
---@field select? SagaKeys select or cancel select item in `project_replace` float window
214+
215+
216+
---@alias LayoutOption "float" | "normal"
217+
---@alias BorderType "none" | "single" | "double" | "rounded" | "solid" | "shadow" | string[]
218+
---@alias SagaKeys string | string[]
219+
220+
221+
---@class LspMethods
222+
---@field [string] string Keys are alias of LSP methods. Values are LSP methods, which you want to show in finder.

0 commit comments

Comments
 (0)