简体   繁体   English

vscode为工作区中的所有函数制作“转到定义”

[英]Vscode make 'go to definition' for all functions in workspace

a.html一个.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="a.js" type="text/javascript"></script>
    <script src="b.js" type="text/javascript"></script>
</body>
</html>

a.js js

function a() {
    console.log("hi")
}

b.js js

a();
console.log("done")

In b.js, I would like to 'go to definition' to a.js.在 b.js 中,我想“转到定义”到 a.js。

In real project, there are a lot of scripts.在实际项目中,有很多脚本。

is it possible?是否可以? and how can I do that unless opening all javascript files.除非打开所有 javascript 文件,否则我该怎么做。

Simply adding an empty jsconfig.json file in the root of your directory will fix this.只需在目录的根目录中添加一个空的 jsconfig.json 文件即可解决此问题。

just save a blank jsconfig.json with {} should work.只需使用{}保存一个空白的 jsconfig.json 即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM