-
-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poor quality matches when searching using lsp_dynamic_workspace_symbols #2104
Comments
Since you showed this with Python, I noticed that it works poorly with Python symbols. JavaScript works as expected. So it's not an universal issue. |
@JoseConseco I'm having the same problem with pyright LSP, I make use of the telescope action: I have it mapped to local actions = require("telescope.actions")
telescope.setup({
...
mappings = {
i = {
...
["<c-f>"] = actions.to_fuzzy_refine,
},
},
},
}) |
Thx, I'm not sure why mappig wont work in my config. But I changed the default dynamic workspace symbols sorter from: To: in |
@stevanmilic works for me, but it's slightly annoying. @JoseConseco Can you show in more detail where and how you set the custom sorter? I'm fairly new to neovim. |
Oh, you mean you edited the actual source of Telescope. Works as a bandaid, but surely that's not the intended way? |
Its not optimal, but I do not think there is way to override sorter that is used by workspace_symbols picker. (unless there is way?) |
I debugged the This telescope config worked for me to manually specify the sorter for the dynamic lsp picker, i.e. forcing usage of the fzf sorter, and now gives me better sorted results in the local telescope = require("telescope")
local fzf_opts = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
telescope.setup {
-- ...
pickers = {
-- Manually set sorter, for some reason not picked up automatically
lsp_dynamic_workspace_symbols = {
sorter = telescope.extensions.fzf.native_fzf_sorter(fzf_opts)
},
},
extensions = {
fzf = fzf_opts
},
-- ...
}
telescope.load_extension('fzf') |
@lundberg your solution works. I did no know we could override sorters like this. |
Yes, tried that one as well, and agree that it is slower, but most important |
@JoseConseco, maybe we should leave this issue open, since it should not be needed to manually set the sorter IMO. Anyone knows why the |
I took a peek at the code, and it seems that it's because |
@lundberg your solution made |
Hooks up fzf to the picker, which for some reason does not happen by default. Reference: nvim-telescope/telescope.nvim#2104 (comment)
Just wanted to add here that if you want to solve this problem without installing an extension, I've gotten good performance using the native pickers = {
lsp_dynamic_workspace_symbols = {
sorter = sorters.get_fzy_sorter(),
}
}
So glad I found this thread! |
@j-krl have you noticed any performance difference in comparison with |
Honestly didn't even try the fzf extension to keep things minimal, but I haven't noticed any performance issues. I think the main pro @lundberg talked about is that fzf actually gives better matches. |
The reason is that telescope is dynamically querying the language server on every input and simply returning the results. This is similar to the But it looks like that's not a behavior we can rely on. You should use the non-dynamic version if you're having issues enough to change the sorter. I'll continue to investigate and explore what to do about this picker in the meantime. |
Yeah I'm pretty sure pyright was just returning the results in ascending order based on file name, so changing the sorter was the best option.
I would happily do this except that none of the LSPs I use will even open because of #964, which has been closed. I rely on this dynamic version pretty heavily so it would be a shame to see it deprecated and have no working alternative. |
Right, I have a feeling #964 is also language server related. They're both literally making the same request except that the dynamic version is constantly updating the request with a query value. They both have the same response processing as well. Maybe the solution to both issue is flip my suggestion around, deprecate the non-dynamic |
As long as I'm following correctly I think this is a better solution. The constant updating in the dynamic version feels more in line with the other uses of Telescope like ripgrep and find_files. You're saying that the non-dynamic version doesn't update as you type but just makes a single query that you have to submit before the searching happens? |
Correct. It makes 1 request (with the provided For instance, after exploring more (I don't personally use either workspace symbol pickers generally) I just noticed that with basedpyright (and possibly regular pyright), I get no results when using a blank query. This effectively makes |
Description
For example seaching for: mute with lsp_dynamic_workspace_symbols I get this order of results:
Often more relevant matches are even lower. I though it shows current document symbols first, but changing active buffer did not change a thing.
Can someone confirm this? (lsp_document_symbols seem to work ok )
I use following mapping:
vim.keymap.set( "n", "<F3>", showWorkspaceSymbols, { noremap = true, silent = true, desc="Show Workspace Symbols" } )
Neovim version
Operating system and version
Manjaro Linux
Telescope version / branch / rev
Latest build using Packer
checkhealth telescope
Steps to reproduce
Expected behavior
Mull matched words should have higher score
Actual behavior
LQ matches are too high
Minimal config
The text was updated successfully, but these errors were encountered: