14 14 require 'bugabinga.lsp.lightbulb' 16 16 local token_update = function ( lsp_client )
17 - local token
= lsp_client.data.token
18 - local buffer
= lsp_client.buffer
19 - local client_id
= lsp_client.data.client_id
20 - local mutable_variable_highlight
= 'MutableVariable' 17 + local token
= lsp_client.data.token
18 + local buffer
= lsp_client.buffer
19 + local client_id
= lsp_client.data.client_id
20 + local mutable_variable_highlight
= 'MutableVariable' 22 - if token.type
== 'variable' and not token.modifiers.readonly
then 23 - vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
22 + if token.type
== 'variable' and not token.modifiers.readonly
then 23 + vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
32 32 local expand_path = function ( path )
33 - if vim.fn.executable( path )
== 1 then 34 - return vim.fn.exepath( path )
33 + if vim.fn.executable( path )
== 1 then 34 + return vim.fn.exepath( path )
40 40 local expand_command = function ( command )
41 - vim.validate {
command = { command, {
'string',
'table', }, }, }
41 + vim.validate {
command = { command, {
'string',
'table', }, }, }
43 - if type( command )
== 'table' then 44 - command[
1]
= expand_path( command[
1] )
43 + if type( command )
== 'table' then 44 + command[
1]
= expand_path( command[
1] )
48 - return expand_path( command )
48 + return expand_path( command )
51 51 local lsp_start = function ( file_type_event )
52 - debug.print
'trying to start lsp' 53 - local match
= file_type_event.match
52 + debug.print
'trying to start lsp' 53 + local match
= file_type_event.match
55 - debug.print(
'filetypes to ignore', ignored.filetypes,
'current filetype', match )
56 - if vim.iter( ignored.filetypes ):find( match )
then return end 55 + debug.print(
'filetypes to ignore', ignored.filetypes,
'current filetype', match )
56 + if vim.iter( ignored.filetypes ):find( match )
then return end 58 - local bufnr
= file_type_event.buf
59 - local buftype
= vim.api.nvim_get_option_value(
'buftype', {
buf = bufnr, } )
60 - debug.print(
'buftypes to ignore', ignored.buftypes,
'current buftype', buftype )
61 - if vim.iter( ignored.buftypes ):find( buftype )
then return end 58 + local bufnr
= file_type_event.buf
59 + local buftype
= vim.api.nvim_get_option_value(
'buftype', {
buf = bufnr, } )
60 + debug.print(
'buftypes to ignore', ignored.buftypes,
'current buftype', buftype )
61 + if vim.iter( ignored.buftypes ):find( buftype )
then return end 63 - local buffer_path
= vim.api.nvim_buf_get_name( bufnr )
63 + local buffer_path
= vim.api.nvim_buf_get_name( bufnr )
65 - debug.print(
string.
format(
'searching lsp client for: match: %s, buffer: %s, path: %s', match, bufnr, buffer_path ) )
65 + debug.print(
string.
format(
'searching lsp client for: match: %s, buffer: %s, path: %s', match, bufnr, buffer_path ) )
67 - local potential_client_configs
= vim.iter( lsp_client_configs )
68 - :map(
function ( config )
70 - [
'config'] = { config,
'table', },
71 - [
'config.name'] = { config.name,
'string', },
72 - [
'config.filetypes'] = { config.filetypes, {
'string',
'table', }, },
73 - [
'config.command'] = { config.command, {
'string',
'table', }, },
74 - [
'config.environment'] = { config.environment,
'table',
true, },
75 - [
'config.root_dir'] = { config.root_dir,
'function',
'string', },
76 - [
'config.single_file_support'] = { config.single_file_support,
'boolean',
true, },
77 - [
'config.settings'] = { config.settings,
'table',
true, },
78 - [
'config.workspaces'] = { config.workspaces,
'boolean',
true, },
79 - [
'config.before_init'] = { config.before_init,
'function',
true, },
80 - [
'config.init_options'] = { config.init_options,
'table',
true, },
81 - [
'config.capabilities'] = { config.capabilities,
'table',
true, },
82 - [
'config.custom_start'] = { config.custom_start,
'function',
true, },
86 - config.command
= type( config.command )
== 'string' and { expand_command( config.command ), }
or 87 - expand_command( config.command )
88 - config.environment
= config.environment
or {}
89 - config.filetypes
= type( config.filetypes )
== 'string' and { config.filetypes, }
or config.filetypes
90 - config.single_file_support
= config.single_file_support
== nil and false or config.single_file_support
91 - config.workspaces
= config.workspaces
== nil and false or config.workspaces
92 - config.capabilities
= config.capabilities
or {}
93 - config.init_options
= config.init_options
or {}
67 + local potential_client_configs
= vim.iter( lsp_client_configs )
68 + :map(
function ( config )
70 + [
'config'] = { config,
'table', },
71 + [
'config.name'] = { config.name,
'string', },
72 + [
'config.filetypes'] = { config.filetypes, {
'string',
'table', }, },
73 + [
'config.command'] = { config.command, {
'string',
'table', }, },
74 + [
'config.environment'] = { config.environment,
'table',
true, },
75 + [
'config.root_dir'] = { config.root_dir,
'function',
'string', },
76 + [
'config.single_file_support'] = { config.single_file_support,
'boolean',
true, },
77 + [
'config.settings'] = { config.settings,
'table',
true, },
78 + [
'config.workspaces'] = { config.workspaces,
'boolean',
true, },
79 + [
'config.before_init'] = { config.before_init,
'function',
true, },
80 + [
'config.init_options'] = { config.init_options,
'table',
true, },
81 + [
'config.capabilities'] = { config.capabilities,
'table',
true, },
82 + [
'config.custom_start'] = { config.custom_start,
'function',
true, },
86 + config.command
= type( config.command )
== 'string' and { expand_command( config.command ), }
or 87 + expand_command( config.command )
88 + config.environment
= config.environment
or {}
89 + config.filetypes
= type( config.filetypes )
== 'string' and { config.filetypes, }
or config.filetypes
90 + config.single_file_support
= config.single_file_support
== nil and false or config.single_file_support
91 + config.workspaces
= config.workspaces
== nil and false or config.workspaces
92 + config.capabilities
= config.capabilities
or {}
93 + config.init_options
= config.init_options
or {}
97 - :filter(
function ( config )
98 - return vim.iter( config.filetypes ):find( match )
97 + :filter(
function ( config )
98 + return vim.iter( config.filetypes ):find( match )
102 - debug.print(
'POTENTIAL CLIENTS',
103 - vim.iter( potential_client_configs ):map(
function ( config )
105 - name = config.name,
102 + debug.print(
'POTENTIAL CLIENTS',
103 + vim.iter( potential_client_configs ):map(
function ( config )
105 + name = config.name,
112 - if table.is_empty( potential_client_configs )
then 113 - debug.print(
'found no lsp client for', buffer_path )
112 + if table.is_empty( potential_client_configs )
then 113 + debug.print(
'found no lsp client for', buffer_path )
120 - local project_local_lsp_settings
= localrc(
'.lsp.settings.lua',
'table' )
or {}
122 + local project_local_lsp_settings
= localrc(
'.lsp.settings.lua',
'table' )
or {}
122 - for _, config
in ipairs( potential_client_configs )
do 123 - local root_dir
= type( config.root_dir )
== 'string' and config.root_dir
or config.root_dir( buffer_path )
124 - local capabilities
= vim.lsp.protocol.make_client_capabilities()
125 - capabilities
= table.extend(
'force', capabilities, config.capabilities )
124 + for _, config
in ipairs( potential_client_configs )
do 125 + local root_dir
= type( config.root_dir )
== 'string' and config.root_dir
or config.root_dir( buffer_path )
126 + local capabilities
= vim.lsp.protocol.make_client_capabilities()
127 + capabilities
= table.extend(
'force', capabilities, config.capabilities )
127 - debug.print(
'starting command:', config.command )
129 + local settings
= config.settings
130 + local settings_override
= project_local_lsp_settings[config.name]
131 + if settings_override
then 132 + debug.print(
'overriding settings with project local settings', settings, settings_override )
133 + settings
= vim.tbl_deep_extend(
'force', settings, settings_override )
129 - local start_config
= {
130 - cmd = config.command,
131 - cmd_cwd = root_dir,
134 - root_dir = root_dir,
136 - capabilities = capabilities,
138 - settings = config.settings,
140 - init_options = config.init_options,
141 - name = config.name,
144 - on_error =
function ( code,
... ) vim.print(
'LSP ERROR', code,
... )
end,
145 - before_init = config.before_init,
147 - on_exit =
function ( code, signal, client_id )
debug.print(
'LSP CLIENT EXIT', code, signal, client_id )
end,
148 - on_attach =
function ( client, attach_bufnr )
debug.print(
'LSP CLIENT ATTACH', client, attach_bufnr )
end,
149 - trace =
debug.get()
and 'on' or 'off',
150 - flags = {
allow_incremental_sync =
true,
debounce_text_changes =
250,
exit_timeout =
200, },
136 + debug.print(
'starting command:', config.command )
153 - local lsp_starter
= config.custom_start
or vim.lsp.start
138 + local start_config
= {
139 + cmd = config.command,
140 + cmd_cwd = root_dir,
143 + root_dir = root_dir,
145 + capabilities = capabilities,
147 + settings = settings,
149 + init_options = config.init_options,
150 + name = config.name,
153 + on_error =
function ( code,
... ) vim.print(
'LSP ERROR', code,
... )
end,
154 + before_init = config.before_init,
156 + on_exit =
function ( code, signal, client_id )
debug.print(
'LSP CLIENT EXIT', code, signal, client_id )
end,
157 + on_attach =
function ( client, attach_bufnr )
debug.print(
'LSP CLIENT ATTACH', client, attach_bufnr )
end,
158 + trace =
debug.get()
and 'on' or 'off',
159 + flags = {
allow_incremental_sync =
true,
debounce_text_changes =
250,
exit_timeout =
200, },
155 - debug.print(
'starting lsp', start_config.name, root_dir )
162 + local lsp_starter
= config.custom_start
or vim.lsp.start
157 - lsp_starter( start_config, {
161 - reuse_client =
function ( existing_client, new_config )
163 - 'lsp resuse client',
164 - existing_client.name,
165 - existing_client.workspace_folders,
167 - new_config.root_dir
164 + debug.print(
'starting lsp', start_config.name, root_dir )
171 - local same_name
= existing_client.name
== new_config.name
166 + lsp_starter( start_config, {
170 + reuse_client =
function ( existing_client, new_config )
172 + 'lsp resuse client',
173 + existing_client.name,
174 + existing_client.workspace_folders,
176 + new_config.root_dir
173 - local new_root_raw
= new_config.root_dir
or nil 174 - local existing_root_raw
= existing_client.workspace_folders
and #existing_client.workspace_folders
>= 1 and 175 - existing_client.workspace_folders[
1].name
or nil 180 + local same_name
= existing_client.name
== new_config.name
177 - if not (new_root_raw
and existing_root_raw)
then return false end 182 + local new_root_raw
= new_config.root_dir
or nil 183 + local existing_root_raw
= existing_client.workspace_folders
and #existing_client.workspace_folders
>= 1 and 184 + existing_client.workspace_folders[
1].name
or nil 179 - local new_root
= vim.fs.normalize( new_root_raw )
180 - local existing_root
= vim.fs.normalize( existing_root_raw )
181 - local same_root
= new_root
== existing_root
186 + if not (new_root_raw
and existing_root_raw)
then return false end 183 - local reuse
= same_name
and same_root
184 - debug.print(
'reusing lsp client?', reuse )
188 + local new_root
= vim.fs.normalize( new_root_raw )
189 + local existing_root
= vim.fs.normalize( existing_root_raw )
190 + local same_root
= new_root
== existing_root
189 - debug.print(
'ATTACHING LSP CLIENT', config.name )
192 + local reuse
= same_name
and same_root
193 + debug.print(
'reusing lsp client?', reuse )
198 + debug.print(
'ATTACHING LSP CLIENT', config.name )
193 202 local old_formatexpr
197 206 local keybinds
= {}
198 207 local add = function ( client_id, keybind_remover )
200 - client_id = { client_id,
'number', },
201 - keybind_remover = { keybind_remover,
'function', },
203 - if not table.contains( keybinds, client_id )
then 204 - keybinds[client_id]
= {}
206 - table.
insert( keybinds[client_id], keybind_remover )
209 + client_id = { client_id,
'number', },
210 + keybind_remover = { keybind_remover,
'function', },
212 + if not table.contains( keybinds, client_id )
then 213 + keybinds[client_id]
= {}
215 + table.
insert( keybinds[client_id], keybind_remover )
209 218 local lsp_attach = function ( args )
210 - local bufnr
= args.buf
211 - local client_id
= args.data.client_id
212 - local client
= vim.lsp.get_client_by_id( client_id )
213 - if not client
then return end 219 + local bufnr
= args.buf
220 + local client_id
= args.data.client_id
221 + local client
= vim.lsp.get_client_by_id( client_id )
222 + if not client
then return end 215 - debug.print( client.server_capabilities )
224 + debug.print( client.server_capabilities )
217 - if client.server_capabilities.definitionProvider
then 218 - old_tagfunc
= vim.bo[bufnr].tagfunc
219 - vim.bo[bufnr].tagfunc
= 'v:lua.vim.lsp.tagfunc' 226 + if client.server_capabilities.definitionProvider
then 227 + old_tagfunc
= vim.bo[bufnr].tagfunc
228 + vim.bo[bufnr].tagfunc
= 'v:lua.vim.lsp.tagfunc' 222 - if client.server_capabilities.documentFormattingProvider
then 223 - old_formatexpr
= vim.bo[bufnr].formatexpr
224 - vim.bo[bufnr].formatexpr
= 'v:lua.vim.lsp.formatexpr' 231 + if client.server_capabilities.documentFormattingProvider
then 232 + old_formatexpr
= vim.bo[bufnr].formatexpr
233 + vim.bo[bufnr].formatexpr
= 'v:lua.vim.lsp.formatexpr' 227 - if client.server_capabilities.completionProvider
then 228 - old_omnifunc
= vim.bo[bufnr].omnifunc
229 - vim.bo[bufnr].omnifunc
= 'v:lua.vim.lsp.omnifunc' 236 + if client.server_capabilities.completionProvider
then 237 + old_omnifunc
= vim.bo[bufnr].omnifunc
238 + vim.bo[bufnr].omnifunc
= 'v:lua.vim.lsp.omnifunc' 232 - if client.server_capabilities.documentSymbolProvider
then 233 - local navic_ok, navic
= pcall(
require,
'nvim-navic' )
235 - navic.attach( client, bufnr )
237 - vim.notify
'nvim-navic not found. could not attach to lsp client.' 239 - local navbuddy_ok, navbuddy
= pcall(
require,
'nvim-navbuddy' )
240 - if navbuddy_ok
then 241 - navbuddy.attach( client, bufnr )
243 - description =
'Open overview of symbols in current buffer',
245 - keys =
'<leader>lo',
246 - command =
function () navbuddy.open( bufnr )
end,
250 - vim.notify
'nvim-navbuddy not found. could not attach to lsp client.' 241 + if client.server_capabilities.documentSymbolProvider
then 242 + local navic_ok, navic
= pcall(
require,
'nvim-navic' )
244 + navic.attach( client, bufnr )
246 + vim.notify
'nvim-navic not found. could not attach to lsp client.' 248 + local navbuddy_ok, navbuddy
= pcall(
require,
'nvim-navbuddy' )
249 + if navbuddy_ok
then 250 + navbuddy.attach( client, bufnr )
252 + description =
'Open overview of symbols in current buffer',
254 + keys =
'<leader>lo',
255 + command =
function () navbuddy.open( bufnr )
end,
259 + vim.notify
'nvim-navbuddy not found. could not attach to lsp client.' 254 - local lsp_signature_ok, lsp_signature
= pcall(
require,
'lsp_signature' )
255 - if lsp_signature_ok
then 256 - lsp_signature.on_attach( {}, bufnr )
263 + local lsp_signature_ok, lsp_signature
= pcall(
require,
'lsp_signature' )
264 + if lsp_signature_ok
then 265 + lsp_signature.on_attach( {}, bufnr )
259 - if client.server_capabilities.documentHighlightProvider
then 262 - local debounced_highlight
= defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
263 - local debounced_clear
= defer.debounce_leading( vim.lsp.buf.clear_references, delay )
268 + if client.server_capabilities.documentHighlightProvider
then 271 + local debounced_highlight
= defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
272 + local debounced_clear
= defer.debounce_leading( vim.lsp.buf.clear_references, delay )
265 - auto
'document_highlight' {
267 - description =
'Highlight symbol under cursor on hold',
268 - events =
'CursorHold',
270 - command = debounced_highlight,
273 - description =
'Remove highlight from symbol under cursor on move',
274 - events = {
'CursorMoved',
'InsertEnter', },
276 - command = debounced_clear,
274 + auto
'document_highlight' {
276 + description =
'Highlight symbol under cursor on hold',
277 + events =
'CursorHold',
279 + command = debounced_highlight,
282 + description =
'Remove highlight from symbol under cursor on move',
283 + events = {
'CursorMoved',
'InsertEnter', },
285 + command = debounced_clear,
281 - if client.server_capabilities.inlayHintProvider
then 282 - add( client_id, map.normal {
283 - description =
'Toggle inlay hints',
286 - keys =
'<leader>ti',
287 - command =
function ()
288 - vim.lsp.inlay_hint.enable( bufnr,
nil )
290 + if client.server_capabilities.inlayHintProvider
then 291 + add( client_id, map.normal {
292 + description =
'Toggle inlay hints',
295 + keys =
'<leader>ti',
296 + command =
function ()
297 + vim.lsp.inlay_hint.enable( bufnr,
nil )
293 - add( client_id, map.normal {
294 - description =
'Show hover documentation above cursor.',
297 - keys = {
'K',
'<leader>lk', },
298 - command = vim.lsp.buf.hover,
302 + add( client_id, map.normal {
303 + description =
'Show hover documentation above cursor.',
306 + keys = {
'K',
'<leader>lk', },
307 + command = vim.lsp.buf.hover,
301 - add( client_id, map.normal {
302 - description =
'Show signature help under cursor.',
305 - keys = {
'H',
'<leader>ls', },
306 - command = vim.lsp.buf.signature_help,
310 + add( client_id, map.normal {
311 + description =
'Show signature help under cursor.',
314 + keys = {
'H',
'<leader>ls', },
315 + command = vim.lsp.buf.signature_help,
309 - add( client_id, map.normal {
310 - description =
'Show available code actions on current line.',
313 - keys =
'<leader>la',
314 - command = vim.lsp.buf.code_action,
318 + add( client_id, map.normal {
319 + description =
'Show available code actions on current line.',
322 + keys =
'<leader>la',
323 + command = vim.lsp.buf.code_action,
317 - add( client_id, map.normal {
318 - description =
'Goto to definition of symbol under cursor.',
321 - keys =
'<leader>ld',
322 - command = vim.lsp.buf.definition,
326 + add( client_id, map.normal {
327 + description =
'Goto to definition of symbol under cursor.',
330 + keys =
'<leader>ld',
331 + command = vim.lsp.buf.definition,
325 - add( client_id, map.normal {
326 - description =
'Show implementations of symbol under cursor.',
329 - keys =
'<leader>li',
330 - command = vim.lsp.buf.implementation,
334 + add( client_id, map.normal {
335 + description =
'Show implementations of symbol under cursor.',
338 + keys =
'<leader>li',
339 + command = vim.lsp.buf.implementation,
333 - add( client_id, map.normal {
334 - description =
'Show incoming calls of symbol under cursor.',
337 - keys =
'<leader>lci',
338 - command = vim.lsp.buf.incoming_calls,
342 + add( client_id, map.normal {
343 + description =
'Show incoming calls of symbol under cursor.',
346 + keys =
'<leader>lci',
347 + command = vim.lsp.buf.incoming_calls,
341 - add( client_id, map.normal {
342 - description =
'Show outgoing calls of symbol under cursor.',
345 - keys =
'<leader>lco',
346 - command = vim.lsp.buf.outgoing_calls,
350 + add( client_id, map.normal {
351 + description =
'Show outgoing calls of symbol under cursor.',
354 + keys =
'<leader>lco',
355 + command = vim.lsp.buf.outgoing_calls,
349 - add( client_id, map.normal {
350 - description =
'Show references of symbol under cursor.',
353 - keys =
'<leader>ln',
354 - command = vim.lsp.buf.references,
358 + add( client_id, map.normal {
359 + description =
'Show references of symbol under cursor.',
362 + keys =
'<leader>ln',
363 + command = vim.lsp.buf.references,
357 - add( client_id, map.normal {
358 - description =
'Rename symbol under cursor.',
361 - keys = {
'<f2>',
'<leader>lr', },
362 - command = vim.lsp.buf.rename,
366 + add( client_id, map.normal {
367 + description =
'Rename symbol under cursor.',
370 + keys = {
'<f2>',
'<leader>lr', },
371 + command = vim.lsp.buf.rename,
366 375 local lsp_detach = function ( args )
367 - debug.print(
'DETACH LSP', args )
376 + debug.print(
'DETACH LSP', args )
369 - local bufnr
= args.buf
370 - local client_id
= args.data.client_id
371 - local client
= vim.lsp.get_client_by_id( client_id )
372 - if not client
then return end 378 + local bufnr
= args.buf
379 + local client_id
= args.data.client_id
380 + local client
= vim.lsp.get_client_by_id( client_id )
381 + if not client
then return end 374 - if client.server_capabilities.definitionProvider
then 375 - vim.bo[bufnr].tagfunc
= old_tagfunc
383 + if client.server_capabilities.definitionProvider
then 384 + vim.bo[bufnr].tagfunc
= old_tagfunc
378 - if client.server_capabilities.documentFormattingProvider
then 379 - vim.bo[bufnr].formatexpr
= old_formatexpr
387 + if client.server_capabilities.documentFormattingProvider
then 388 + vim.bo[bufnr].formatexpr
= old_formatexpr
382 - if client.server_capabilities.completionProvider
then 383 - vim.bo[bufnr].omnifunc
= old_omnifunc
391 + if client.server_capabilities.completionProvider
then 392 + vim.bo[bufnr].omnifunc
= old_omnifunc
386 - if table.contains( keybinds, client_id )
then 387 - for _, keybind_delete
in ipairs( keybinds[client_id] )
do 395 + if table.contains( keybinds, client_id )
then 396 + for _, keybind_delete
in ipairs( keybinds[client_id] )
do 395 - description =
'Start or reuse LSP client',
396 - events =
'FileType',
397 - command = lsp_start,
400 - description =
'Hook: LSP client attached to buffer',
401 - events =
'LspAttach',
402 - command = lsp_attach,
405 - description =
'Hook: LSP client detached from buffer',
406 - events =
'LspDetach',
407 - command = lsp_detach,
410 - description =
'Semantic Tokens from the LSP',
411 - events =
'LspTokenUpdate',
412 - command = token_update,
404 + description =
'Start or reuse LSP client',
405 + events =
'FileType',
406 + command = lsp_start,
409 + description =
'Hook: LSP client attached to buffer',
410 + events =
'LspAttach',
411 + command = lsp_attach,
414 + description =
'Hook: LSP client detached from buffer',
415 + events =
'LspDetach',
416 + command = lsp_detach,
419 + description =
'Semantic Tokens from the LSP',
420 + events =
'LspTokenUpdate',
421 + command = token_update,
416 425 local lsp_info = function ( command )
417 - local all_or_current
= command.args
and command.args
== 'all' and {}
or {
bufnr =
0, }
418 - local active_clients
= vim.lsp.get_clients( all_or_current )
426 + local all_or_current
= command.args
and command.args
== 'all' and {}
or {
bufnr =
0, }
427 + local active_clients
= vim.lsp.get_clients( all_or_current )
420 - local infos
= vim.iter( active_clients )
421 - :map(
function ( client )
422 - local name
= client.name
423 - local config
= vim.iter( lsp_client_configs ):find(
function ( config )
return config.name
== name
end )
424 - assert( config, (
'How did we not find a config for %s ?!?!'):format( name ) )
429 + local infos
= vim.iter( active_clients )
430 + :map(
function ( client )
431 + local name
= client.name
432 + local config
= vim.iter( lsp_client_configs ):find(
function ( config )
return config.name
== name
end )
433 + assert( config, (
'How did we not find a config for %s ?!?!'):format( name ) )
426 - local full_cmd
= table.deep_copy( client.config.cmd )
427 - full_cmd[
1]
= vim.fn.exepath( full_cmd[
1] )
431 - cmd =
table.
concat( full_cmd,
' ' ),
432 - workspace_folders = vim.iter( client.workspace_folders ):map(
function ( w )
return vim.fs.normalize( w.name )
end )
434 - filetypes =
table.
concat( config.filetypes,
', ' ),
435 - single_file_support = config.single_file_support,
436 - workspaces = config.workspaces,
435 + local full_cmd
= table.deep_copy( client.config.cmd )
436 + full_cmd[
1]
= vim.fn.exepath( full_cmd[
1] )
440 + cmd =
table.
concat( full_cmd,
' ' ),
441 + workspace_folders = vim.iter( client.workspace_folders ):map(
function ( w )
return vim.fs.normalize( w.name )
end )
443 + filetypes =
table.
concat( config.filetypes,
', ' ),
444 + single_file_support = config.single_file_support,
445 + workspaces = config.workspaces,
442 - ui.show_tree( infos )
451 + ui.show_tree( infos )
445 454 local lsp_info_extended = function ( command )
446 - local all_or_current
= command.args
and command.args
== 'all' and {}
or {
bufnr =
0, }
447 - local active_clients
= vim.lsp.get_clients( all_or_current )
448 - ui.show_tree( active_clients )
455 + local all_or_current
= command.args
and command.args
== 'all' and {}
or {
bufnr =
0, }
456 + local active_clients
= vim.lsp.get_clients( all_or_current )
457 + ui.show_tree( active_clients )
451 460 user_command(
'LspInfo', lsp_info, {
453 - complete =
function ()
return {
'all', }
end,
454 - desc =
'Shows basic information about running LSP clients.',
462 + complete =
function ()
return {
'all', }
end,
463 + desc =
'Shows basic information about running LSP clients.',
457 466 user_command(
'LspInfoExtended', lsp_info_extended, {
459 - complete =
function ()
return {
'all', }
end,
460 - desc =
'Shows detailed information about running LSP clients.',
468 + complete =
function ()
return {
'all', }
end,
469 + desc =
'Shows detailed information about running LSP clients.',
466 475 local completion_icons
= {
470 - Constructor =
' ',
479 + Constructor =
' ',
490 499 local completion_kinds
= vim.lsp.protocol.CompletionItemKind
491 500 for i, kind
in ipairs( completion_kinds )
do 492 - completion_kinds[i]
= completion_icons[kind]
or kind
501 + completion_kinds[i]
= completion_icons[kind]
or kind
495 504 return setmetatable( _, {} )