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

Find usages (find all file references / find all folder references) #66162

Open
jabacchetta opened this issue Jan 7, 2019 · 20 comments
Open
Assignees
Labels
editor-symbols definitions, declarations, references feature-request Request for new features or functionality
Milestone

Comments

@jabacchetta
Copy link

jabacchetta commented Jan 7, 2019

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.

@vscodebot
Copy link

vscodebot bot commented Jan 7, 2019

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

@jabacchetta jabacchetta changed the title Find Usages (aka Find all Folder and File References) Find usages (aka find all file references / find all folder references) Jan 7, 2019
@jabacchetta jabacchetta changed the title Find usages (aka find all file references / find all folder references) Find usages (find all file references / find all folder references) Jan 7, 2019
@RMacfarlane RMacfarlane added the feature-request Request for new features or functionality label Jan 7, 2019
@korimas
Copy link

korimas commented Apr 4, 2019

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

@jrieken jrieken added the editor-symbols definitions, declarations, references label Apr 4, 2019
@alexilyaev
Copy link

alexilyaev commented Jun 12, 2019

@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.

@jabacchetta
Copy link
Author

jabacchetta commented Jun 20, 2019

@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.

@alexilyaev
Copy link

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).

@askhogan
Copy link

askhogan commented Jul 5, 2019

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.

@jrieken jrieken added this to the Backlog milestone Jan 13, 2020
@baoanhng
Copy link

baoanhng commented Mar 15, 2020

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.

@jonlepage
Copy link

jonlepage commented Nov 20, 2020

for now i found this solution but is really overkill and need a lot of configuration
but here we go, all reference and connection between files imports exports.
image
Really need this in vscode, but without visual node, this will help on productivity on big project architecture.

https://github.com/pahen/madge

Hope to see a search files ref relations soon !

@tjx666
Copy link
Contributor

tjx666 commented Sep 18, 2021

Very useful feature

@liisi29
Copy link

liisi29 commented Aug 22, 2022

Any news about this feature? 2 years past, still very much in need of it!

@tjx666
Copy link
Contributor

tjx666 commented Aug 22, 2022

I often think that vscode had already implememted find variable/type reference, why not imllements file reference. It should be easier.

@alexilyaev
Copy link

alexilyaev commented Aug 25, 2022

EDIT:
Works only on JS/TS files, not for CSS files for example


I'm happy to say that today I found out that Find File References has been added to VS Code in the File Explorer and file tab context menu:
image

Now only missing Find Folder References (didn't find an open issue for that).

@liisi29
Copy link

liisi29 commented Aug 25, 2022

"Find usages" for a function is also missing. How do you develop without that?
This is currently the only thing that keeps me from migrating from Webstorm. But really.. how do you find your method references without "find usages"?
And, no.. just semantic "find all from files" search will not do :D

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 25, 2022

@liisi29 That already exists: right click on the function and select find all references. It is built-in for JS/TS. For other languages you need to install an extension that adds support

@liisi29
Copy link

liisi29 commented Aug 27, 2022

@liisi29 That already exists: right click on the function and select find all references. It is built-in for JS/TS. For other languages you need to install an extension that adds support

Correct me if I'm wrong (and I really hope I am), but this only finds references in ONE file. Not in the whole application.
"Find usages" in Webstorm finds the references in whole application and that functionality is exactly what I am missing (a lot!).

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 28, 2022

@liisi29 Try creating a jsconfig or tsconfig to define a JS/TS project

Screen Shot 2022-08-28 at 9 21 30 AM

@alexilyaev
Copy link

@liisi29 That already exists: right click on the function and select find all references. It is built-in for JS/TS. For other languages you need to install an extension that adds support

Correct me if I'm wrong (and I really hope I am), but this only finds references in ONE file. Not in the whole application. "Find usages" in Webstorm finds the references in whole application and that functionality is exactly what I am missing (a lot!).

By default without jsconfig or tsconfig (as mentioned above) VS Code only looks at the open files.
I opened an issue about it way back but it was closed:
#75341

@MarvinXu
Copy link

MarvinXu commented Sep 9, 2023

Very useful feature. I have many outdated resources in my project that may no longer be referenced, but It's hard to find them all.

@zhibirc
Copy link

zhibirc commented Sep 18, 2023

Doesn't work for *.js files in my installation, shows just the file itself. :) Not very useful.
No special configs, no opened files except of one file that I'm trying to find occurrences of.

Package info:

Version: 1.82.2 (Universal)
Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
Date: 2023-09-14T05:59:47.790Z
Electron: 25.8.1
ElectronBuildId: 23779380
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 21.6.0

@zhibirc
Copy link

zhibirc commented Sep 18, 2023

Used this grep -r -n -I "<file_name>" ./ (recursive, show line numbers, skip binary files) to stay on VScode. But, unfortunately, without quick jump to items in search results. Feels like Slackware user in 2012.

# wrap to alias function for easy usage
findstr () { grep -r -n -I "$1" ./; }
# usage example
findstr wp-service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-symbols definitions, declarations, references feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests