“Find All References” across files for a method/fu

2020-05-25 07:54发布

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.

3条回答
姐就是有狂的资本
2楼-- · 2020-05-25 08:27

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

查看更多
何必那么认真
3楼-- · 2020-05-25 08:28

In Visual Studio Code you can do this by first highlighting the text you want to search for, then using the command: CTRL + SHIFT + F (pressing all at once).

CTRL + SHIFT + F is just a shortcut for accessing the search tab on the left-hand side of VSCode. Hope that helps and apologies for the scribbles :)

enter image description here

查看更多
淡お忘
4楼-- · 2020-05-25 08:31

Please try this: https://marketplace.visualstudio.com/items?itemName=zhengx666.find-usages

Not the same as webstorm but still does the trick pretty much.

查看更多
登录 后发表回答