From ea347b18d883999ed9a8d2e7c00068058135232f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 2 May 2020 17:56:05 +0200 Subject: lsp: add workspace/symbol (#12224) * lsp: add workspace/symbol * refactor symbol callback * set hierarchical symbol support to true * add documentation and default mapping Co-authored-by: Hirokazu Hata --- runtime/lua/vim/lsp/callbacks.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/callbacks.lua') diff --git a/runtime/lua/vim/lsp/callbacks.lua b/runtime/lua/vim/lsp/callbacks.lua index bd2cbf1ea7..70d21be8e7 100644 --- a/runtime/lua/vim/lsp/callbacks.lua +++ b/runtime/lua/vim/lsp/callbacks.lua @@ -54,13 +54,15 @@ M['textDocument/references'] = function(_, _, result) api.nvim_command("wincmd p") end -M['textDocument/documentSymbol'] = function(_, _, result, _, bufnr) +local symbol_callback = function(_, _, result, _, bufnr) if not result or vim.tbl_isempty(result) then return end util.set_qflist(util.symbols_to_items(result, bufnr)) api.nvim_command("copen") api.nvim_command("wincmd p") end +M['textDocument/documentSymbol'] = symbol_callback +M['workspace/symbol'] = symbol_callback M['textDocument/rename'] = function(_, _, result) if not result then return end -- cgit