feat: add filtering by symbol(s) to lsp_{document,workspace}_symbols (#903)

This commit is contained in:
fdschmidt93
2021-06-10 23:10:18 +02:00
committed by GitHub
parent 1407ac3400
commit e27c87f88a
4 changed files with 111 additions and 25 deletions

View File

@@ -107,6 +107,12 @@ lsp.document_symbols = function(opts)
vim.list_extend(locations, vim.lsp.util.symbols_to_items(server_results.result, 0) or {})
end
locations = utils.filter_symbols(locations, opts)
if locations == nil then
-- error message already printed in `utils.filter_symbols`
return
end
if vim.tbl_isempty(locations) then
return
end
@@ -263,6 +269,12 @@ lsp.workspace_symbols = function(opts)
end
end
locations = utils.filter_symbols(locations, opts)
if locations == nil then
-- error message already printed in `utils.filter_symbols`
return
end
if vim.tbl_isempty(locations) then
print("No results from workspace/symbol. Maybe try a different query: " ..
"Telescope lsp_workspace_symbols query=example")