mirror of
https://github.com/neovim/neovim.git
synced 2026-04-24 16:25:40 +00:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user