简体   繁体   English

VS Code“转到定义”不存在 - Javascript

[英]VS Code “Go To Definition” does not exist - Javascript

I am using VScode version 1.57.我正在使用 VScode 1.57 版。

The issue is that it Simply cant not navigate to the definition, "Go To definition" not working.问题是它根本无法导航到定义,“转到定义”不起作用。

as you can see in an image it does not exists.正如您在图像中看到的那样,它不存在。

What I have tried:我尝试过的:

  • clearing settings.json清除 settings.json
  • deleting all extentions删除所有扩展
  • resinstallign VS Code重新安装 VS Code
  • changing Key F12 to Shift + `将 F12 键更改为 Shift + `

simply need to navigate to definition, I searched through documentation of VSCode it must read Javascrit files, I even added jsx and js next to ts, tsx but in this simple example below it still does not work.只需要导航到定义,我搜索了 VSCode 的文档,它必须读取 Javascrit 文件,我什至在 ts、tsx 旁边添加了 jsx 和 js,但在下面的这个简单示例中,它仍然不起作用。

open image打开图片

Your import is importing the entire ./test.js file as the variable sum thus there is no single method definition as you are expecting.您的导入将整个./test.js文件作为变量sum导入,因此没有您期望的单一方法定义。

If you want sum to be your actual function called sum you need to change your import statement to:如果您希望 sum 成为名为sum的实际函数,则需要将import语句更改为:

import { sum } from './test'

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

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