“查找所有参考文献"VSCode 中方法/函数的跨文件是不可能的 [英] "Find All References" across files for a method/function in VSCode is not possible

查看:45
本文介绍了“查找所有参考文献"VSCode 中方法/函数的跨文件是不可能的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio Code 版本 1.27.2

Visual Studio Code version 1.27.2

Find all References 只列出当前文件中的引用.我需要在项目中跨文件查找所有引用.

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

有可能吗?

类似查找用法

如果您右键单击 symbol 并选择查找用法".如果当前符号是 function,则查找用法"会搜索调用此函数的所有位置.如果当前符号是一个变量,那么查找用法"会搜索所有使用这个变量的地方等等.

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.

推荐答案

Find all references 等高级功能由每个语言扩展实现.

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

对于 JavaScript,尝试创建一个 jsconfig.json 位于工作区根目录下,内容为:

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

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

此文件告诉 VS Code 将工作区中的所有 JS 文件视为同一 javascript 项目的一部分.如果您的代码过于动态,查找所有引用 在 JavaScript 中仍可能无法正常工作.它最适合使用import/exportclass 和friends

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

这篇关于“查找所有参考文献"VSCode 中方法/函数的跨文件是不可能的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆