commit 6849dd6e38d82927bdf0dbdc8d20f130ac966e02
parent 1a31b6a161f7286267e456950b45b82edeb59c69
Author: Tomas Nemec <owl@gtms.dev>
Date: Thu, 9 May 2024 11:08:43 +0200
update
Diffstat:
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
@@ -110,7 +110,26 @@ vim.api.nvim_create_autocmd('LspAttach', {
})
local handlers = vim.lsp.handlers
-vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(handlers.hover, { border = 'single' })
+handlers['callHierarchy/outgoingCalls'] =
+ function(_, result)
+ if not result then
+ return
+ end
+ local items = {}
+ for _, call_hierarchy_call in pairs(result) do
+ local call_hierarchy_item = call_hierarchy_call['to']
+ table.insert(items, {
+ filename = assert(vim.uri_to_fname(call_hierarchy_item.uri)),
+ text = call_hierarchy_item.name,
+ lnum = call_hierarchy_item.selectionRange.start.line + 1,
+ col = call_hierarchy_item.selectionRange.start.character + 1,
+ })
+ end
+ vim.fn.setqflist({}, ' ', { title = 'LSP call hierarchy', items = items })
+ vim.cmd('botright copen')
+ end
+
+handlers['textDocument/hover'] = vim.lsp.with(handlers.hover, { border = 'single' })
handlers['textDocument/signatureHelp'] = vim.lsp.with(handlers.signature_help, { border = 'single' })
local crc = handlers['client/registerCapability']
handlers['client/registerCapability'] = function(_, result, ctx)