aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/denols.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-04-21 13:43:00 -0700
committerGitHub <noreply@github.com>2025-04-21 13:43:00 -0700
commit44ba712bc3015cce9b599d18f947d85a630e512b (patch)
treeae71e900e2c0c8f34bca009c4ec1f3e0d3d21051 /lsp/denols.lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.gz
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.bz2
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.lz
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.xz
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.zst
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.zip
ci(lint): use client:exec_cmd() #3755
Use `client:exec_cmd()` instead of calling `request("workspace/executeCommand")` directly.
Diffstat (limited to 'lsp/denols.lua')
-rw-r--r--lsp/denols.lua28
1 files changed, 10 insertions, 18 deletions
diff --git a/lsp/denols.lua b/lsp/denols.lua
index 80ff679e..b7a6466a 100644
--- a/lsp/denols.lua
+++ b/lsp/denols.lua
@@ -15,19 +15,6 @@
local lsp = vim.lsp
-local function buf_cache(bufnr, client)
- local params = {
- command = 'deno.cache',
- arguments = { {}, vim.uri_from_bufnr(bufnr) },
- }
- client.request('workspace/executeCommand', params, function(err, _result, ctx)
- if err then
- local uri = ctx.params.arguments[2]
- vim.api.nvim_err_writeln('cache command failed for ' .. vim.uri_to_fname(uri))
- end
- end, bufnr)
-end
-
local function virtual_text_document_handler(uri, res, client)
if not res then
return nil
@@ -105,12 +92,17 @@ return {
['textDocument/typeDefinition'] = denols_handler,
['textDocument/references'] = denols_handler,
},
- on_attach = function()
+ on_attach = function(client, bufnr)
vim.api.nvim_buf_create_user_command(0, 'LspDenolsCache', function()
- local clients = vim.lsp.get_clients { bufnr = 0, name = 'denols' }
- if #clients > 0 then
- buf_cache(0, clients[#clients])
- end
+ client:exec_cmd({
+ command = 'deno.cache',
+ arguments = { {}, vim.uri_from_bufnr(bufnr) },
+ }, { bufnr = bufnr }, function(err, _result, ctx)
+ if err then
+ local uri = ctx.params.arguments[2]
+ vim.api.nvim_err_writeln('cache command failed for ' .. vim.uri_to_fname(uri))
+ end
+ end)
end, {
desc = 'Cache a module and all of its dependencies.',
})