aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/codelens.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-11-01 03:14:59 -0700
committerGitHub <noreply@github.com>2021-11-01 03:14:59 -0700
commit519d8deb08f369c559e7cbd61627c56db88623f1 (patch)
treef215ba8c220931f08bd2b67660680316df2fea49 /runtime/lua/vim/lsp/codelens.lua
parent7ae86c1d4caffec57e2d4d44e40a9feba91d96dd (diff)
downloadrneovim-519d8deb08f369c559e7cbd61627c56db88623f1.tar.gz
rneovim-519d8deb08f369c559e7cbd61627c56db88623f1.tar.bz2
rneovim-519d8deb08f369c559e7cbd61627c56db88623f1.zip
feat(lsp): add per-client commands (#16101)
Diffstat (limited to 'runtime/lua/vim/lsp/codelens.lua')
-rw-r--r--runtime/lua/vim/lsp/codelens.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index 63fcbe430b..9eb64c9a2e 100644
--- a/runtime/lua/vim/lsp/codelens.lua
+++ b/runtime/lua/vim/lsp/codelens.lua
@@ -31,15 +31,15 @@ local function execute_lens(lens, bufnr, client_id)
local line = lens.range.start.line
api.nvim_buf_clear_namespace(bufnr, namespaces[client_id], line, line + 1)
+ local client = vim.lsp.get_client_by_id(client_id)
+ assert(client, 'Client is required to execute lens, client_id=' .. client_id)
local command = lens.command
- local fn = vim.lsp.commands[command.command]
+ local fn = client.commands[command.command] or vim.lsp.commands[command.command]
if fn then
fn(command, { bufnr = bufnr, client_id = client_id })
return
end
-- Need to use the client that returned the lens → must not use buf_request
- local client = vim.lsp.get_client_by_id(client_id)
- assert(client, 'Client is required to execute lens, client_id=' .. client_id)
local command_provider = client.server_capabilities.executeCommandProvider
local commands = type(command_provider) == 'table' and command_provider.commands or {}
if not vim.tbl_contains(commands, command.command) then