You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is that lspconfig requires the command table for a client config that is passed to the lspconfig .setup method call to be of type table, where the key is the command name and the value is array table of two values which requires the first value to be a function, and the second optional one to be a description. That however does not match what lsp core expects for the client.config.commands, which for the commands table is simple key - function mapping. Lspconfig does not transform the commands' table when passing it to start the lspclient
For some inexplicable, reason, lspconfig is creating those commands as user commands, which is useless, since those commands are not meant to be used like that anyway.
Here is how it is actually used to produce some user commands
Pretty much obvious where the issue is, property name either should change to user_commands, since it is confusing, or transform it to match what core expects, so it is actually correct.
Neovim version
NVIM 9.0.0
Nvim-lspconfig version
master
Operating system and version
Ubuntu 22
Affected language servers
all
Steps to reproduce
Invoke .setup with {commands = { ["command.name"] = function() ..... end }
Observe that the validation fails since it expects the value against the key to be array of two values function and description.
Actual behavior
Commands table is not propagated to the lsp.core which has an explicit handle when executing commands, instead it just sets them as UserCommands.
At the moment the workaround is to set it to the globals commands table @ vim.lsp.commands, or force override the lsp_configs[server_name] which will bypass the validation, instead of passing to .setup which tries to validate the passed in user_config.
Expected behavior
Either rename this commands, because it does not respect the interface expected by lsp core and client.config.commands , property or handle it correctly, i.e correct the validation, or transform the table to match the lsp core specs.
Minimal config
Notapplicable
LSP log
not applicable
The text was updated successfully, but these errors were encountered:
The workaround above however breaks, because there is an autocmd in lspconfig which still tries to read the passed in commands table, and create the user commands. Ideally that should not exist, but it is quite annoying.
Description
The issue is that lspconfig requires the command table for a client config that is passed to the lspconfig .setup method call to be of type table, where the key is the command name and the value is array table of two values which requires the first value to be a function, and the second optional one to be a description. That however does not match what lsp core expects for the client.config.commands, which for the commands table is simple key - function mapping. Lspconfig does not transform the commands' table when passing it to start the lspclient
For some inexplicable, reason, lspconfig is creating those commands as user commands, which is useless, since those commands are not meant to be used like that anyway.
Here is how it is actually used to produce some user commands
Here is the validation that lspconfig does, at
configs.lua:46
Here is how the lsp core is using client.commands , at
lsp/buf.lua:807
Pretty much obvious where the issue is, property name either should change to user_commands, since it is confusing, or transform it to match what core expects, so it is actually correct.
Neovim version
NVIM 9.0.0
Nvim-lspconfig version
master
Operating system and version
Ubuntu 22
Affected language servers
all
Steps to reproduce
Actual behavior
Commands table is not propagated to the lsp.core which has an explicit handle when executing commands, instead it just sets them as UserCommands.
At the moment the workaround is to set it to the globals commands table @ vim.lsp.commands, or force override the lsp_configs[server_name] which will bypass the validation, instead of passing to .setup which tries to validate the passed in user_config.
Expected behavior
Either rename this commands, because it does not respect the interface expected by lsp core and client.config.commands , property or handle it correctly, i.e correct the validation, or transform the table to match the lsp core specs.
Minimal config
LSP log
not applicable
The text was updated successfully, but these errors were encountered: