aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/callbacks.lua
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2020-05-02 17:56:05 +0200
committerGitHub <noreply@github.com>2020-05-02 17:56:05 +0200
commitea347b18d883999ed9a8d2e7c00068058135232f (patch)
treeca1271a72e36e45d6450f8009f9f6e668576c1f5 /runtime/lua/vim/lsp/callbacks.lua
parent2f42e4d0c86163e64eb56077939fe405dc434e42 (diff)
downloadrneovim-ea347b18d883999ed9a8d2e7c00068058135232f.tar.gz
rneovim-ea347b18d883999ed9a8d2e7c00068058135232f.tar.bz2
rneovim-ea347b18d883999ed9a8d2e7c00068058135232f.zip
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 <h.hata.ai.t@gmail.com>
Diffstat (limited to 'runtime/lua/vim/lsp/callbacks.lua')
-rw-r--r--runtime/lua/vim/lsp/callbacks.lua4
1 files changed, 3 insertions, 1 deletions
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