Reputation: 549
Are there any extensions/features in vs-code which could let me know where the current file is imported? I usually do a global search of the filename but it is time consuming when the file name is similar to any variable or there are similar named files.
Upvotes: 23
Views: 25571
Reputation: 302
NO EXTENSION REQUIRED
Yes, We can find the references of a file in VSCODE like this: Right-click on the file and then select Find References.
VSCODE will show all the references/imports of the file. image reference
Upvotes: 7
Reputation: 1624
you can use this extension in vscode to find all unused exports
click on name then press shift+alt+F12
Upvotes: 1
Reputation: 408
If you are limiting your search to the current open workspace / folder, you can
In this way you will discover all of the imports that involve your module, regardless of whether you have used 'import mymodule' or 'from mymodule import myfunction' or anything else. I'm specifically thinking of how I'd structure a python project, but if you are using another language, you can alter the search in a way that works for the way your language does imports.
Upvotes: 0
Reputation: 1726
Right-click > Go to References (Shift + F12) There is also an extension to change the appearance of how references show https://marketplace.visualstudio.com/items?itemName=jrieken.references-plusplus
Upvotes: 0
Reputation: 342
You can do a right-click on every function / variable or class. Then you choose "Find all references" to show where each function / variable or class is called. For this you do not need an extension, because it is a standard feature of vscode
Upvotes: 14