summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/lsp.lua
diff options
context:
space:
mode:
authorfdschmidt93 <39233597+fdschmidt93@users.noreply.github.com>2021-06-10 23:10:18 +0200
committerGitHub <noreply@github.com>2021-06-10 23:10:18 +0200
commite27c87f88a7f726058e7672eeb980bfe1dad2d12 (patch)
treed18369d834f0038a3f160357f934fc1902b28e1e /lua/telescope/builtin/lsp.lua
parent1407ac3400971bcdbcf8b8026ff6957edfada1a3 (diff)
feat: add filtering by symbol(s) to lsp_{document,workspace}_symbols (#903)
Diffstat (limited to 'lua/telescope/builtin/lsp.lua')
-rw-r--r--lua/telescope/builtin/lsp.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua
index 6a3492b..532f221 100644
--- a/lua/telescope/builtin/lsp.lua
+++ b/lua/telescope/builtin/lsp.lua
@@ -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")