"Go to Symbol in Workspace..." - searching for symbols using more than one word/substring
See original GitHub issueSearching for symbols with multiple keywords/substrings via the feature: “Go to Symbol in Workspace…”
Main Request
When using “Go to Symbol in Workspace…” (ctrl-T by default) to find symbols anywhere in the current workspace, is there a way to search for symbols that contains two separate words/substrings?
e.g. Let’s say I have a function called oneTwoThree()
somewhere in my project, but I can’t remember the exact name of it… I should be able to find it with any 2 word search query such as:
- one three
- three one
- on thr
- tw on
…and any other two (or more) substrings that are contained in the name. Yet none of these work, my oneTwoThree()
function is never shown in the results (yet a lot of other irrelevant stuff is due to full filepath names that aren’t even in the symbol name).
Is there any way to use this search feature with two (or more words) when they might not be joined or in a specific order? If not could this please be improved so that it works in the same way as “Go to File…” does, which does allow you to search using two+ substrings (is there any reason why these work so differently?)
I found a setting called: search.quickOpen.includeSymbols
- which will also include symbols in the “Go to File…” results, yet it has the exact same issue - it seems to use completely different filtering methods for filenames vs symbols.
I’m finding that since switching to vscode, I’ve written a lot of duplicate functions that do the same thing due to not being able to find functions by name using more than one word/substring.
Side Question 1:
While looking into this, I came across setting: typescript.workspaceSymbols.scope
which has two options:
allOpenProjects
— (default) search all opened projects for symbols.currentProject
— Only search the current project
…but I can’t figure out what the definition of “project” means here. I’ve tried changing the setting and don’t see any different behavior. It doesn’t seem mean “workspace”, nor exclude node_modules/*
from the results. So what does it mean by “project”? This doesn’t seem to be a regular term used in vscode.
Side Question 2:
Is there any way to exclude node_modules/*
code from “Go to Symbol in Workspace…” results? …but while still having vscode be aware of it in others contexts like typing and still being able to ctrl-click to navigate into it? It seems most of my results are stuff from node_modules/*
- and there’s no prioritization that displays my own code above all the node_modules/*
results.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:27
- Comments:9 (1 by maintainers)
Top GitHub Comments
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
You should make it more explicit that this request is for TypeScript/JavaScript to support this. As best I can tell, the
WorkspaceSymbolProvider
API would not prevent these from being implemented. Your title and main request make it seem like the issue is with “Go to Symbol in Workspace…” generally.