Vscode: Find usages (find all file references / find all folder references)

Created on 7 Jan 2019  路  7Comments  路  Source: microsoft/vscode

If you search the issues here on GitHub and on StackOverflow, you'll find that there is a ton of fragmentation around this feature for a few reasons:

  • Everyone is referring to different subsets of the feature
  • Everyone is calling it by different names (users coming from WebStorm will refer to it as "Find Usages")
  • VSCode actually already has this partially implemented, but it's hidden and not documented well.

This feature refers to three subsets of finding references:

1. Find all references of a symbol

VSCode has this already.

2. Find all references of a file

VSCode has this already, but few know about it, and the process for getting to it is unnecessary. Currently you need to use the "find all references" command on an import path that includes the file.

This is a very useful feature, and should be made available in the file explorer, for a file's context menu when right clicking it, as explained here. Additionally, there should be a command, References: Find All References of File as explained here.

3. Find all references of a folder

VSCode does not yet have this feature. When using this on a folder (made available in the context menu), it should show the references for all files inside that folder. A command might be useful here as well (References: Find All References of Folder).

Note:

I've already submitted a feature request mentioning this in the past, which was closed and suggested as an extension. However, it looks like I wasn't clear on what my request was, because VSCode has since implemented a lot of this functionality. And it's also clear that there's a lot of confusion around this among VSCode users.

editor-symbols feature-request

Most helpful comment

This is the single biggest disappointment coming from WebStorm. VSCode wins in so many ways. The two areas that cause weekly pain are:

  1. Lack of ability to Find Usages of file, which is essential when refactoring or renaming or organizing folder structure.
  2. Lack of ability to rename a file and have the editor automatically change the references to the renamed file.

All 7 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

I spent one day for this, and the result was no way to achieve it.
sadly.

@jabacchetta Was there any progress on this?

For me, in simple ES6 code with export and import in several files, there's no way to find the references.

If I right click the exported symbol and click Find All References, it will only find references in the open files in the editor, which is not so useful.

@alexilyaev

The features that I've requested here haven't been added yet, but what you're describing should work, if I understand correctly.

Are you importing index.js files without explicitly using the entire path (leaving off index.js) by chance? If so, #66170 might be helpful.

Edit: Woops, just noticed that you already solved your problem in issue above.

It only works after adding jsconfig.json, but still, you need to pick a specific export to search references for, you can't search for all references to the whole module (as you suggest).

This is the single biggest disappointment coming from WebStorm. VSCode wins in so many ways. The two areas that cause weekly pain are:

  1. Lack of ability to Find Usages of file, which is essential when refactoring or renaming or organizing folder structure.
  2. Lack of ability to rename a file and have the editor automatically change the references to the renamed file.

Finally in the backlog, which will take like 2 years or more. But at least there's a milestone.

I can't believe people can keep using VSCode without a proper "find usages". It is the only reason I still stick with Sublime Text.
For me as a PHP developer, there's no way you can deal with non-namespace, autoloaded methods and functions without find usages.

Was this page helpful?
0 / 5 - 0 ratings