Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Find All References" across files for a method/function in VSCode is not possible

Visual Studio Code version 1.27.2

Find all References only list references in the current file. I need to find all references across files in a project.

Is it possible ?

Something like find usages

If you right click a symbol and select "find usages". If the current symbol is a function, then "find usages" searches for all places where this function is called. If the current symbol is a variable, then "find usages" searches for all places where this variable is used etc etc.

like image 366
rinold simon Avatar asked Oct 06 '18 09:10

rinold simon


People also ask

How do I enable find all references in Visual Studio code?

The Find All References command is available on the context (right-click) menu of the element you want to find references to. Or, if you are a keyboard user, press Shift + F12.

How do I search all files in VS Code?

To perform a search across all your open files, use the following shortcuts. For Mac use “Command + Shift + F”. For Windows and all other operating systems use “Ctrl + Shift + F”.


1 Answers

Advanced features such as Find all references are implemented by each language extension.

For JavaScript, try creating a jsconfig.json at the root of your workspace with the contents:

{     "compilerOptions": {         "target": "ES6"     },     "exclude": [         "node_modules",         "**/node_modules/*"     ] } 

This file tells VS Code to treat all JS files in your workspace as part of the same javascript project. Find all references still may not work properly in JavaScript if your code is too dynamic. It works best against modern js that uses import/export, class, and friends

like image 98
Matt Bierner Avatar answered Oct 24 '22 11:10

Matt Bierner