Skip to content

Go to Symbol in Workspace... strips all results if query contains * or # (and maybe others) #171320

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

Open
Veykril opened this issue Jan 14, 2023 · 4 comments
Assignees
Labels
feature-request Request for new features or functionality quick-open Quick-open issues (search, commands)
Milestone

Comments

@Veykril
Copy link

Veykril commented Jan 14, 2023

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.74.3 (user setup)
  • OS Version: Version: Windows_NT x64 10.0.19044

Steps to Reproduce:

  1. Install rust-analyzer and open a barebones cargo project with a fn main() {} function
  2. Open Go to Symbol in Workspace... action and type main, you should see the main function appear
  3. Now append a # to the query (resulting in foo#), the main function should still be listed (as rust-analyzer accepts this symbol to mean search for functions in current workspace only), but instead the entry for the function disappear.

I confirmed that the actual unmodified query makes it to the rust-analyzer server, so something in a later stage of VSCode seems to remove all result entries if it encounters a * or # in the query (and probably for even more symbols).

I assume this is due to VSCode filtering by entries by prefix which seems unfortunate as rust-analyzer wants to be able to configure the search space via these symbols on the fly. Is there some way the extension can opt out of this filtering perhaps?

@Tyriar Tyriar assigned TylerLeonhardt and unassigned Tyriar Jan 27, 2023
@TylerLeonhardt TylerLeonhardt added feature-request Request for new features or functionality quick-open Quick-open issues (search, commands) labels Feb 2, 2023
@TylerLeonhardt TylerLeonhardt added this to the Backlog milestone Feb 2, 2023
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Feb 2, 2023

Right now, yes * and # are factored in to the query. We should revisit this to see if there's room for improvement. Although I wonder if it's best to use a different mechanism than the appending of #.

What does the * do in your case?

@Veykril
Copy link
Author

Veykril commented Feb 3, 2023

We use * and # as appended symbols to the query to change the searching mode.
Basically the modes are as follows:

  • Foo searches for Foo type in the current workspace
  • foo# searches for foo function in the current workspace
  • Foo* searches for Foo type among dependencies, including stdlib
  • foo#* searches for foo function among dependencies

Having this modularity is nice, as rust-analyzer needs it for performance reasons (searching through all dependencies can take some time) and because some projects can have a ton of matching results.

Is VSCode's own query syntax described somewhere? (I didn't manage to find it last time I tried searching for it).

@Veykril
Copy link
Author

Veykril commented Sep 2, 2023

Additionally, something that would be nice if we could do it is allow foo::bar as a query, as that is a proper rust path which could be interpreted as searching for the foo symbol within bar's scope (where bar is not necessarily just a module)

@CinchBlue
Copy link

Does this also block :? I noticed I can't search by that -- that seems very important for C++ and Rust developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality quick-open Quick-open issues (search, commands)
Projects
None yet
Development

No branches or pull requests

5 participants