我正在从 Webstorm 迁移到 Visual Studio Code。 Webstorm 的表现非常糟糕。
Visual Studio 代码对于查找我需要的依赖项并导入它们并不是很有帮助。到目前为止,我一直在手动进行,但老实说,我宁愿等待 15 秒让 webstorm 找到并添加我必须手动挖掘的导入。
我正在使用来自@minko-gechev https://github.com/mgechev/angular2-seed 的 angular2 种子
我的 baseDir 中有一个 tsconfig.json,如下所示:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"pretty": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true
},
"exclude": [
"node_modules",
"dist",
"typings/index.d.ts",
"typings/modules",
"src"
],
"compileOnSave": false
}
我的 src/client 目录中有另一个,如下所示:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true
}
}
我不知道为什么有两个。 angualr 种子项目使用打字稿 gulp 构建任务,所以我猜编译是不同的。
我该怎么做才能让 vscode 更有帮助?
原文由 reach4thelasers 发布,翻译遵循 CC BY-SA 4.0 许可协议
我通过安装下面的各种插件来完成这项工作。
大多数情况下,只要我输入类名,事情就会自行导入。或者,会出现一个灯泡,您可以单击它。或者您可以按
F1
,然后输入“import…”,那里也有各种选项。我有点使用它们。用于实现接口的F1
实现也很有帮助,但并不总是有效。插件列表
扩展截图
* 点击查看完整分辨率