Skip to content

Commit 8eb2d60

Browse files
authored
fix!(lsp): use generic_sorter for dynamic_workspace_symbols (#3250)
The `highlighter_only` sorter should be reserved for pickers that have finders that already return results in an some good order (ie. like `live_grep`). But this isn't something that language server reliably do and some return results in frankly useless orders. So swapping out the sorter for `conf.generic_sorter`.
1 parent be6a84e commit 8eb2d60

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

doc/telescope.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,9 @@ options you want to use. Here's an example with the live_grep picker: >lua
839839
builtin.live_grep({opts}) *telescope.builtin.live_grep()*
840840
Search for a string and get results live as you type, respects .gitignore
841841

842+
Default keymaps:
843+
`<C-space>`: refine current results with a fuzzy search
844+
842845
Parameters: ~
843846
{opts} (`table?`)
844847
{cwd}? (`string`, default: cwd, use utils.buffer_dir() to
@@ -1563,9 +1566,7 @@ builtin.lsp_dynamic_workspace_symbols({opts})
15631566
Dynamically lists LSP for all workspace symbols
15641567

15651568
Default keymaps:
1566-
`<C-l>`: show autocompletion menu to prefilter your query by type of
1567-
symbol you want to see (i.e. `:variable:`), only works after refining to
1568-
fuzzy search using `<C-space>`
1569+
`<C-space>`: refine current results with a fuzzy search
15691570

15701571
Parameters: ~
15711572
{opts} (`table?`)

lua/telescope/builtin/__lsp.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ local lsp = vim.lsp
55

66
local channel = require("plenary.async.control").channel
77
local actions = require "telescope.actions"
8-
local sorters = require "telescope.sorters"
98
local conf = require("telescope.config").values
109
local finders = require "telescope.finders"
1110
local make_entry = require "telescope.make_entry"
@@ -455,7 +454,7 @@ M.dynamic_workspace_symbols = function(opts)
455454
fn = get_workspace_symbols_requester(opts.bufnr, opts),
456455
},
457456
previewer = conf.qflist_previewer(opts),
458-
sorter = sorters.highlighter_only(opts),
457+
sorter = conf.generic_sorter(opts),
459458
attach_mappings = function(_, map)
460459
map("i", "<c-space>", actions.to_fuzzy_refine)
461460
return true

lua/telescope/builtin/init.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ end
5454
---@field file_encoding? string file encoding for the entry & previewer
5555

5656
--- Search for a string and get results live as you type, respects .gitignore
57+
---
58+
--- Default keymaps:
59+
--- - `<C-space>`: refine current results with a fuzzy search
5760
---@param opts? telescope.builtin.live_grep.opts table: options to pass to the picker
5861
builtin.live_grep = require_on_exported_call("telescope.builtin.__files").live_grep
5962

@@ -625,9 +628,7 @@ builtin.lsp_workspace_symbols = require_on_exported_call("telescope.builtin.__ls
625628
--- Dynamically lists LSP for all workspace symbols
626629
---
627630
--- Default keymaps:
628-
--- - `<C-l>`: show autocompletion menu to prefilter your query by type of
629-
--- symbol you want to see (i.e. `:variable:`), only works after refining to
630-
--- fuzzy search using `<C-space>`
631+
--- - `<C-space>`: refine current results with a fuzzy search
631632
---@param opts? telescope.builtin.lsp_dynamic_workspace_symbols.opts: options to pass to the picker
632633
builtin.lsp_dynamic_workspace_symbols = require_on_exported_call("telescope.builtin.__lsp").dynamic_workspace_symbols
633634

0 commit comments

Comments
 (0)