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:
@@ -1657,7 +1657,8 @@ builtin.lsp_dynamic_workspace_symbols({opts}) *telescope.builtin.lsp_dynamic_wor
|
||||
Dynamically lists LSP for all workspace symbols
|
||||
- Default keymaps:
|
||||
- `<C-l>`: show autocompletion menu to prefilter your query by type of
|
||||
symbol you want to see (i.e. `:variable:`)
|
||||
symbol you want to see (i.e. `:variable:`), only works after refining
|
||||
to fuzzy search using <C-space>
|
||||
|
||||
|
||||
Parameters: ~
|
||||
@@ -3168,6 +3169,17 @@ action_set.scroll_previewer({prompt_bufnr}, {direction}) *telescope.actions.set.
|
||||
{direction} (number) The direction of the scrolling
|
||||
|
||||
|
||||
action_set.scroll_horizontal_previewer({prompt_bufnr}, {direction}) *telescope.actions.set.scroll_horizontal_previewer()*
|
||||
Scrolls the previewer to the left or right. Defaults to a half page scroll,
|
||||
but can be overridden using the `scroll_speed` option in `layout_config`.
|
||||
See |telescope.layout| for more details.
|
||||
|
||||
|
||||
Parameters: ~
|
||||
{prompt_bufnr} (number) The prompt bufnr
|
||||
{direction} (number) The direction of the scrolling
|
||||
|
||||
|
||||
action_set.scroll_results({prompt_bufnr}, {direction}) *telescope.actions.set.scroll_results()*
|
||||
Scrolls the results up or down. Defaults to a half page scroll, but can be
|
||||
overridden using the `scroll_speed` option in `layout_config`. See
|
||||
@@ -3179,6 +3191,17 @@ action_set.scroll_results({prompt_bufnr}, {direction}) *telescope.actions.set.sc
|
||||
{direction} (number) The direction of the scrolling
|
||||
|
||||
|
||||
action_set.scroll_horizontal_results({prompt_bufnr}, {direction}) *telescope.actions.set.scroll_horizontal_results()*
|
||||
Scrolls the results to the left or right. Defaults to a half page scroll,
|
||||
but can be overridden using the `scroll_speed` option in `layout_config`.
|
||||
See |telescope.layout| for more details.
|
||||
|
||||
|
||||
Parameters: ~
|
||||
{prompt_bufnr} (number) The prompt bufnr
|
||||
{direction} (number) The direction of the scrolling
|
||||
|
||||
|
||||
|
||||
================================================================================
|
||||
ACTIONS_LAYOUT *telescope.actions.layout*
|
||||
@@ -3456,7 +3479,7 @@ previewers.Previewer() *telescope.previewers.Previewer()*
|
||||
application, like less.
|
||||
- `scroll_fn` function(self, direction): Used to make scrolling work.
|
||||
- `scroll_horizontal_fn` function(self, direction): Used to make
|
||||
horizontal scrolling work.
|
||||
horizontal scrolling work.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -482,7 +482,7 @@ builtin.lsp_workspace_symbols = require_on_exported_call("telescope.builtin.__ls
|
||||
|
||||
--- Dynamically lists LSP for all workspace symbols
|
||||
--- - Default keymaps:
|
||||
--- - `<C-l>`: show autocompletion menu to prefilter your query by type of symbol you want to see (i.e. `:variable:`)
|
||||
--- - `<C-l>`: show autocompletion menu to prefilter your query by type of symbol you want to see (i.e. `:variable:`), only works after refining to fuzzy search using <C-space>
|
||||
---@param opts table: options to pass to the picker
|
||||
---@field fname_width number: defines the width of the filename section (default: 30)
|
||||
---@field show_line boolean: if true, shows the content of the line the symbol is found on (default: false)
|
||||
|
||||
Reference in New Issue
Block a user