aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorHibiki <mail@4513echo.dev>2024-02-13 16:14:15 +0900
committerGitHub <noreply@github.com>2024-02-13 15:14:15 +0800
commitafb9339be6a9485409ea3ffcb73677660a6d5889 (patch)
tree16743f8df9a0f2850130de289dece624836909ea /lua
parentci: bump JohnnyMorganz/stylua-action from 3 to 4 (diff)
downloadnvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.tar
nvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.tar.gz
nvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.tar.bz2
nvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.tar.lz
nvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.tar.xz
nvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.tar.zst
nvim-lspconfig-afb9339be6a9485409ea3ffcb73677660a6d5889.zip
fix(denols): add new deno.cache request implmention (#3007)
* fix: Follow latest denols implmention * fix: Query clients with bufnr
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/denols.lua27
1 files changed, 9 insertions, 18 deletions
diff --git a/lua/lspconfig/server_configurations/denols.lua b/lua/lspconfig/server_configurations/denols.lua
index 4443352c..7cf58203 100644
--- a/lua/lspconfig/server_configurations/denols.lua
+++ b/lua/lspconfig/server_configurations/denols.lua
@@ -2,12 +2,13 @@ local util = require 'lspconfig.util'
local lsp = vim.lsp
local function buf_cache(bufnr, client)
- local params = {}
- params['referrer'] = { uri = vim.uri_from_bufnr(bufnr) }
- params['uris'] = {}
- client.request('deno/cache', params, function(err, _result, ctx)
+ 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.referrer.uri
+ local uri = ctx.params.arguments[2]
vim.api.nvim_err_writeln('cache command failed for ' .. vim.uri_to_fname(uri))
end
end, bufnr)
@@ -90,24 +91,14 @@ return {
['textDocument/definition'] = denols_handler,
['textDocument/typeDefinition'] = denols_handler,
['textDocument/references'] = denols_handler,
- ['workspace/executeCommand'] = function(err, result, context, config)
- if context.params.command == 'deno.cache' then
- buf_cache(context.bufnr, vim.lsp.get_client_by_id(context.client_id))
- else
- lsp.handlers[context.method](err, result, context, config)
- end
- end,
},
},
commands = {
DenolsCache = {
function()
- local clients = vim.lsp.get_active_clients()
- for _, client in ipairs(clients) do
- if client.name == 'denols' then
- buf_cache(0, client)
- break
- end
+ local clients = vim.lsp.get_active_clients { bufnr = 0, name = 'denols' }
+ if #clients > 0 then
+ buf_cache(0, clients[#clients])
end
end,
description = 'Cache a module and all of its dependencies.',