Vscode: Add fuzzy search to search by symbol

Created on 3 Sep 2017  路  16Comments  路  Source: microsoft/vscode

Currently on VSCode you can 'Open symbol by name' (https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name) across files by clicking Cmd+T.

However it doesn't seem to support fuzzy search.

E.g. If I have a function called dao_get_bookings and search for dao (notice space at the end), it will not return any results. The space is counted strictly as a character meaning the search breaks down. This is a real shame as Sublime makes this effortless and frankly amazing for this use case.

*caused-by-extension feature-request quick-pick workspace-symbols

Most helpful comment

Just want to echo that this feature is a big deal for users considering a switch from Sublime Text, and I haven't been able to find an extension that supports fuzzy symbol search. I use symbols very often and for me, it's the area I've found the most lacking overall in VS Code. Having a symbol (in this case a method) show up in Go to Symbol but not when I use Go to Definition (in the same file) is disappointing. I get the impression that Go to Symbol and Open symbol by name have completely different plumbing.

All 16 comments

This is especially an issue for Python projects. It just doesn't work unfortunately.

Any idea when this will be actioned?

Just want to echo that this feature is a big deal for users considering a switch from Sublime Text, and I haven't been able to find an extension that supports fuzzy symbol search. I use symbols very often and for me, it's the area I've found the most lacking overall in VS Code. Having a symbol (in this case a method) show up in Go to Symbol but not when I use Go to Definition (in the same file) is disappointing. I get the impression that Go to Symbol and Open symbol by name have completely different plumbing.

I'm new with VS Code, I have used Sublime Text and Eclipse for a few years.
I use always the searching by symbol while work.
I noticed that takes some inaccurate results than Sublime Text in cases like below.

  1. symbols with Under and Upper case naming
    example 1)
    onSomeHandle()
    onAnotherSomeHandle()
    let search with words such as 'osh' using by ctrl+shift+o
    the result element list are:
    VS Code =>
    onAnotherSomeHandle()
    onSomeHandle()

Sublime Text=>
onSomeHandle()
onAnotherSomeHandle()

what I want is onSomeHandle().

example 2)
setDBook()
setDefineSome(bool)
onStoreDefineAddressBook()
let search with such as 'sdb'
the results :
VS Code =>
onStoreDefineAddressBook()
setDefineSome(bool)
setDBook()
Sublime Text =>
setDBook()
onStoreDefineAddressBook()
setDefineSome(bool)

what I want is setDBook()

  1. On the candidates list, It doesn't focus to the symbol in where the cursor is on editor when search box is invoked by ctrl+shift+o, it always get focus at the top element.
    Sublime Text focus to the symbol in which gets the cursor in editor.
    In my experience, It gets better convenient in Sublime Text.

also if I search as get_bookings to find dao_get_bookings it wouldnt work. The search string should begin exactly as the one you are trying to find. Sublime text fuzzy search can do find with all the following search terms.

  1. dao_
  2. get_bookings
  3. dgb
  4. gb
  5. doa_get_bookinsg (notice the mis-spellings)

Would love to have this in vscode as well, not just in symbol search, but everywhere including cmd+shift+p, cmd+p, cmd+shift+o etc.,

I second this as well. Currently it is up to the extension developer to create the same fuzzy search as VSCode's Ctrl+P.

If the fuzzy search algorithm could be included in the extension API, a lot more extensions would use it. (Like mine!)
It does not need to have all the features of QuickOpen like history etc.

Right now I'm using RegExp search, but that is not as user friendly.

Bump on this, any updates? Is it been considered at all?

I'm looking for that feature too, it exists in ATOM.

+1
This feature would be very much appreciated by all former Sublime Text users.

It's really unfortunate that doa_get_bookinsg in cmd+p doesn't find the dao_get_bookings file, and that one has to get the spelling exactly right without typos every time - run into this multiple times everyday 馃槥 馃槥

I actually thought there is some technical problem, such as that each language server must implement their own fuzzy search for this to work. But since this is marked "quick-pick" probably the index is kept by the VSCode itself and it's just not plugged in like in quick outline?

My main issue is simply using a space. It should be smart enough to know that a space can mean /. When I use other editors I often do a few letters for each folder with a space between them and get the file I want. In vscode I have to specifically use the / and no form of typo will work so the search needs to be exact for a lot of stuff and it's forever frustrating on a large codebase.

The sorting and ranking (in the UI) is actually using our fuzzy search logic but that only helps when the extension that provides the data uses a similar relaxed algorithm. In the jsdoc we have the following statement

  • The query-parameter should be interpreted in a relaxed way as the editor will apply its own highlighting and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the characters of query appear in their order in a candidate symbol. Don't use prefix, substring, or similar strict matching.

There is not much more VS Code can do as it is only rendering results that extension providing. Therefore closing as 'caused by extension' and with a pretty please to file this in the context of each extension. Happy Coding

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

Thanks for the heads-up!

to those followed this for python language, there seems to be an issue filed here - microsoft/python-language-server#697.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trstringer picture trstringer  路  3Comments

vsccarl picture vsccarl  路  3Comments

villiv picture villiv  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

mrkiley picture mrkiley  路  3Comments