telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

`lsp_dynamic_workspace_symbols` should prioritize matches for files in current working directory

Open macintacos opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

I am using the sumneko_lua LSP with the lua-dev plugin to get completion/documentation/etc. for the neovim API, among other things. I noticed while using the lsp_dynamic_workspace_symbols picker that when searching for a symbol (for example "horizontal") the matches for my current file are placed way below the matches for other random symbols that I'm looking for. Here's an example:

CleanShot 2022-08-07 at 14 10 40@2x

If there any way to adjust this to have it prefer matches for files in the current working directory? I don't mind the other matches, I just want the sorting to more heavily weight my own files instead of symbols in the broader workspace.

macintacos avatar Aug 07 '22 18:08 macintacos

This is already possible via the telescope.defaults.file_ignore_patterns. For example

If you are getting a lot of jdt:// entries like this:

image

you can use this configuration

require("telescope").setup({
  defaults = {
    file_ignore_patterns = {
      "^jdt://",
    },
...
...
})

with that file_ignore_patterns , the :Telescope lsp_dynamic_workspace_symbols will not show any entry starting with jdt://:

image

ecerulm avatar Aug 01 '24 08:08 ecerulm

Thanks @ecerulm! That's totally fair, however, I don't necessarily want to get rid of the other options, I just want the sorting algorithm to be skewed more towards showing symbols that match in the currently working directory before all others.

Although I'll be honest, I stopped using Telescope for this a while ago, so I have no idea what the sorting algorithm is like now.

macintacos avatar Aug 01 '24 16:08 macintacos