Skip to content
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

"Go To Symbol in Workspace" command provides inconvenient UX in some cases. #17022

Closed
kkovalevskiy opened this issue Dec 10, 2016 · 16 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) javascript JavaScript support issues typescript Typescript support issues

Comments

@kkovalevskiy
Copy link

kkovalevskiy commented Dec 10, 2016

  • VSCode Version: Code 1.7.2 (7ba55c5, 2016-11-21T22:06:37.428Z)
  • OS Version: Windows_NT ia32 6.3.9600
  • Extensions:
Extension Author Version
vscode-file-peek abierbaum 1.0.1
html-snippets abusaidm 0.0.18
project-manager alefragnani 0.12.2
path-intellisense christian-kohler 1.1.0
githistory donjayamanne 0.1.2
vscode-generate-getter-setter DSKWRK 0.4.1
EditorConfig EditorConfig 0.3.4
tslint eg2 0.7.1
RelativePath jakob101 0.11.0
docthis joelday 0.3.5
Angular2 johnpapa 1.0.2
refactorix krizzdewizz 0.3.0
debugger-for-chrome msjsdiag 2.3.2
typescript-hero rbbit 0.11.0
vscode-icons robertohuertasm 4.0.5
vscode-terminal-here Tyriar 0.0.5
gitblame waderyan 1.3.0

"Go To Symbol in Workspace" command (CTRL+T) is one of the most useful commands used for navigation in workspace, but in some cases it can be not so useful as it could be. Here is a couple of examples (usually I use VS code for typescript projects):

  1. When I run vs code and there are no opened files, CTRL+T doesn't provide any result. For new users of VS code it's a bit unobvious fact, that you should open some file before perform some navigation.
  2. If I have several tsconfig.json files in my workspace (atleast two), it performs search only within nearest one relative to an editing file. So, I can't see any classes and interfaces from the first project if I'm editing a file from the second project.

I suppose that this a bit strange behaviour origins from Typescript Language Service (tsserver), but can these issues be resolved on VS Code side? Most of users expect that "Go To Symbol in Workspace" performs search through whole workspace folder and through all projects in this workspace.

Thanks for awesome editor, it's really great!

@jrieken jrieken assigned mjbvz and unassigned jrieken Dec 12, 2016
@jrieken
Copy link
Member

jrieken commented Dec 12, 2016

That's a problem specific to TypeScripts WorkspaceSymbolProvider and how tsserver works

@mjbvz mjbvz added javascript JavaScript support issues typescript Typescript support issues labels Jan 5, 2017
@deadbeef84
Copy link

When I run vs code and there are no opened files, CTRL+T doesn't provide any result. For new users of VS code it's a bit unobvious fact, that you should open some file before perform some navigation.

This also confused me. I have a habit of closing all open files every now and then, but then CTRL+T wont work, so now I mostly use Go to file... (CTRL+P) to avoid this confusion all together.

I don't know how tsserver works, but wouldn't it be possible to use the project root folder as the tsserver root? Especially considering I have a tsconfig.json there.

@brunetton
Copy link

brunetton commented Oct 4, 2017

When I run vs code and there are no opened files, CTRL+T doesn't provide any result. For new users of VS code it's a bit unobvious fact, that you should open some file before perform some navigation.

Indeed. All my dev team just tried the new VSCode version to check out if this "broken" feature has been "repaired"; but we was quite disappointed seeing that "Goto symbol in workspace" still doesn't return any result.

If I understand well, "Goto symbol in workspace" is only looking in opened files ? Maybe should it be renamed to "Goto symbol in opened files" instead ?

@mjbvz mjbvz mentioned this issue Apr 2, 2018
@rajinder-yadav
Copy link

rajinder-yadav commented Apr 3, 2018

I would love to be able to search for any symbol from the project and have them appear first, before other NPM modules or external imports.

@imsedim
Copy link

imsedim commented Apr 25, 2018

Years since first reported
Still no commits?
How come, VScode Team?

@CaoLiSheng
Copy link

I run into the same problem. cmd+t can only search in opened files and maybe some related files.

@smelukov
Copy link

smelukov commented Jun 11, 2018

The same confusing... I expect that Go To Symbol in Workspace is not dependent on opened files.
Seems like the extensions that implement WorkspaceSymbolProvider doing it incorrect cause they must provide searching in a whole workspace but in the most cases they are using DocumentSymbolProvider (inside WorkspaceSymbolProvider) to cache the symbols and populate a list of available symbols, but DocumentSymbolProvider is executing by vscode only for opened files. Even in builtin extensions https://github.com/Microsoft/vscode/blob/558c694d473142173ebe6e1d3fb5be8d84d24ba3/extensions/markdown-language-features/src/features/workspaceSymbolProvider.ts#L134
But another question is: should vscode provide an API to help to index a workspace (eg auto-indexation and populating the symbols in the workspace)?

@sterling000
Copy link

This issue is a deal breaker for me and why i can't switch from full blown visual studio, i work on a project that's had hundreds of devs over 5 years so there are thousands of scripts, some with class names that don't match exactly the file name, some files have multiple classes/structs/enums in them and not being able to navigate to them quickly, or at all in the case where a coworker knows the name of a symbol but not the name of the file it was in (This of course also an issue because the actual search panel itself is slow and filtering it is not very intuitive)

@leidegre
Copy link

@jrieken this is incredibly annoying but easy enough to work around. How do we fix this? What specifically is it that the tsserver does that is preventing this feature from working as if I had all my TS file opened in the first place? For the most time it does find stuff but whenever you switch workspace or restart VS code it's back to nothing.

@rajinder-yadav
Copy link

Anyone looking into fixing this?

@rmariuzzo
Copy link

I would be happy to help if someone can point to the cause in the source.

@gennaro-tedesco
Copy link

has this been looked into, ever since?

@bhagatparwinder
Copy link

This has been open for a while! Why can't I search for symbol when no file is open in workspace?

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 24, 2020

Not searching all projects is a duplicate of #11026 (fixed with TS 3.9)

Search requiring a file is a duplicate of #11173

@mjbvz mjbvz closed this as completed Apr 24, 2020
@mjbvz mjbvz added *duplicate Issue identified as a duplicate of another issue(s) and removed bug Issue identified by VS Code Team member as probable bug labels Apr 24, 2020
@syabro
Copy link

syabro commented Apr 24, 2020

@mjbvz does it work only with TS?
What's about python/es6 classes for example?

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 24, 2020

This issue (and the linked ones) are about JS/TS

If you see the same issue but for Python, please file an issue against the python extension

@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) javascript JavaScript support issues typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests