fix(lsp_dynamic_workspace_symbols): add prefilter as per documentation (after to_fuzzy_refine) (#2584)

* fix(lsp_dynamic_workspace_symbols): add prefilter as per documentation (after to_fuzzy_refine)

* [docgen] Update doc/telescope.txt
skip-checks: true

* docs grammar

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
Co-authored-by: James Trew <j.trew10@gmail.com>
This commit is contained in:
Nghia Le Minh
2023-06-25 05:11:35 +07:00
committed by GitHub
parent 5fff2a138b
commit 219584a6ef
3 changed files with 43 additions and 10 deletions

View File

@@ -1338,20 +1338,30 @@ end
---@param prompt_bufnr number: The prompt bufnr
actions.to_fuzzy_refine = function(prompt_bufnr)
local line = action_state.get_current_line()
local prefix = (function()
local opts = (function()
local opts = {
sorter = conf.generic_sorter {},
}
local title = action_state.get_current_picker(prompt_bufnr).prompt_title
if title == "Live Grep" then
return "Find Word"
opts.prefix = "Find Word"
elseif title == "LSP Dynamic Workspace Symbols" then
return "LSP Workspace Symbols"
opts.prefix = "LSP Workspace Symbols"
opts.sorter = conf.prefilter_sorter {
tag = "symbol_type",
sorter = opts.sorter,
}
else
return "Fuzzy over"
opts.prefix = "Fuzzy over"
end
return opts
end)()
require("telescope.actions.generate").refine(prompt_bufnr, {
prompt_title = string.format("%s (%s)", prefix, line),
sorter = conf.generic_sorter {},
prompt_title = string.format("%s (%s)", opts.prefix, line),
sorter = opts.sorter,
})
end