简体   繁体   English

Visual Studio Code Intellisense Javascript导入

[英]Visual Studio Code Intellisense Javascript import

I am testing if Visual Studio Code is the right code editor for me for js scripts. 我正在测试Visual Studio Code是否适合我的js脚本代码编辑器。

Currently I cannot get intellisense to work on imported classes with es6. 目前,我无法使用Intellisense在es6上处理导入的类。

I'm not sure if I am doing it correctly, but after following some documentation and other stackoverflow questions on exports I still can't get it to work. 我不确定我是否做得正确,但是在遵循了有关导出的一些文档和其他stackoverflow问题之后,我仍然无法使它正常工作。 I also already put common js and allowSyntheticDefaultImports as true in the js.config file. 我还已经在js.config文件中将通用js和allowSyntheticDefaultImports设置为true。

export class SimpleClass{
  constructor() {

  }

  getName(){
      console.log(name);
  }
}

在此处输入图片说明

I seem to fixed it by changing my settings importing line looks like 我似乎通过更改设置导入行来修复它

    {
   "compilerOptions":{
      "target":"es6",
      "allowSyntheticDefaultImports": true
   },
}

It seems my import line was incorrect and then I changed it to import{SimpleClass} from "./mainclass" 看来我的导入行不正确,然后将其从“ ./mainclass”更改为import {SimpleClass}

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

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