question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Go to Symbol in Workspace..." - searching for symbols using more than one word/substring

See original GitHub issue

Searching 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:open
  • Created 3 years ago
  • Reactions:27
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vscode-triage-botcommented, Oct 30, 2020

🙂 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!

1reaction
KamasamaKcommented, Oct 29, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use "Go to symbol" and "Go to symbol in workspace" in VS ...
Ruby Symbols supports symbols, but only in the current file, not the entire workspace. ruby · visual-studio-code · language-server-protocol.
Read more >
how to search for multiple words/substrings? : r/vscode - Reddit
When using "Go to Symbol in Workplace..." (ctrl-T by default) to find symbols anywhere in the current workspace, is there a way to...
Read more >
[string].substring(start, end) - Studio Code.org
You need to use a variable containing a string, followed by a dot ("."), followed by the function name substring with two number...
Read more >
VS Code tips — Go to symbol in workspace - YouTube
7.3K views 2 years ago ... Today's VS Code command: go to symbol in workspace Quickly search and jump to symbols (such as...
Read more >
1.4 The Find Symbols Dialog - Code Builder - OriginLab
The Find Symbols dialog box lists all symbols in the current workspace ... To open one or multiple symbols in Text Editor, click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found