aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/client.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-05-28 12:39:30 -0500
committerGitHub <noreply@github.com>2024-05-28 12:39:30 -0500
commit0bdd602bf974fdefc348f47bb7b9057521eb0407 (patch)
tree5bec46754be4714b72e10a8ebe295d9606d0d59d /runtime/lua/vim/lsp/client.lua
parent8ba73f0e4cc6c82032a348a1d6c8d794ed150fd7 (diff)
parente6cfcaed184d4ecdc8a8638429e1bd9e1b3251dc (diff)
downloadrneovim-0bdd602bf974fdefc348f47bb7b9057521eb0407.tar.gz
rneovim-0bdd602bf974fdefc348f47bb7b9057521eb0407.tar.bz2
rneovim-0bdd602bf974fdefc348f47bb7b9057521eb0407.zip
Merge pull request #27339 from MariaSolOs/completion
feat(lsp): completion side effects
Diffstat (limited to 'runtime/lua/vim/lsp/client.lua')
-rw-r--r--runtime/lua/vim/lsp/client.lua23
1 files changed, 14 insertions, 9 deletions
diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua
index 58ea7d02b3..327cd19125 100644
--- a/runtime/lua/vim/lsp/client.lua
+++ b/runtime/lua/vim/lsp/client.lua
@@ -868,7 +868,8 @@ end
--- @param command lsp.Command
--- @param context? {bufnr: integer}
--- @param handler? lsp.Handler only called if a server command
-function Client:_exec_cmd(command, context, handler)
+--- @param on_unsupported? function handler invoked when the command is not supported by the client.
+function Client:_exec_cmd(command, context, handler, on_unsupported)
context = vim.deepcopy(context or {}, true) --[[@as lsp.HandlerContext]]
context.bufnr = context.bufnr or api.nvim_get_current_buf()
context.client_id = self.id
@@ -882,14 +883,18 @@ function Client:_exec_cmd(command, context, handler)
local command_provider = self.server_capabilities.executeCommandProvider
local commands = type(command_provider) == 'table' and command_provider.commands or {}
if not vim.list_contains(commands, cmdname) then
- vim.notify_once(
- string.format(
- 'Language server `%s` does not support command `%s`. This command may require a client extension.',
- self.name,
- cmdname
- ),
- vim.log.levels.WARN
- )
+ if on_unsupported then
+ on_unsupported()
+ else
+ vim.notify_once(
+ string.format(
+ 'Language server `%s` does not support command `%s`. This command may require a client extension.',
+ self.name,
+ cmdname
+ ),
+ vim.log.levels.WARN
+ )
+ end
return
end
-- Not using command directly to exclude extra properties,