diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2021-09-22 00:05:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 15:05:49 -0700 |
commit | 8164adc1441b2150737bb7e30c59de73176d6447 (patch) | |
tree | 654fbefcbd4577d75e937135569d199586820b64 /runtime/lua/vim/lsp/buf.lua | |
parent | a65d8c34e6427fea00bf9a3d35752fc00054d503 (diff) | |
download | rneovim-8164adc1441b2150737bb7e30c59de73176d6447.tar.gz rneovim-8164adc1441b2150737bb7e30c59de73176d6447.tar.bz2 rneovim-8164adc1441b2150737bb7e30c59de73176d6447.zip |
fix(lsp): update lsp-handler signature in call_hierarchy (#15738)
This fixes the handler signature and also prevents n+1 requests firing
if there are multiple clients.
(The first `prepareCallHierarchy` handler is called once per client,
each invocation used `buf_request` to make more requests using *all*
clients)
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 8bfcd90f12..054f7aee04 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -321,13 +321,21 @@ end ---@private local function call_hierarchy(method) local params = util.make_position_params() - request('textDocument/prepareCallHierarchy', params, function(err, _, result) + request('textDocument/prepareCallHierarchy', params, function(err, result, ctx) if err then vim.notify(err.message, vim.log.levels.WARN) return end local call_hierarchy_item = pick_call_hierarchy_item(result) - vim.lsp.buf_request(0, method, { item = call_hierarchy_item }) + local client = vim.lsp.get_client_by_id(ctx.client_id) + if client then + client.request(method, { item = call_hierarchy_item }, nil, ctx.bufnr) + else + vim.notify(string.format( + 'Client with id=%d disappeared during call hierarchy request', ctx.client_id), + vim.log.levels.WARN + ) + end end) end |