当前位置: 首页 > 知识库问答 >
问题:

Visual Studio代码自动导入

乌俊健
2023-03-14

我正在从Webstorm转换到Visual Studio代码。在Webstorm中的表现是糟糕透顶的。

Visual studio代码对于查找所需的依赖项并导入它们没有很大帮助。到目前为止,我一直在手动操作,但老实说,我宁愿等15秒webstorm找到并添加我的导入,这些导入必须手动查找。

我使用的是@minko-gechev https://github.com/mgechev/angular2-seed的angular2种子

    {
  "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
}
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "allowSyntheticDefaultImports": true
  }
}

我怎么做才能让vscode更有帮助??

共有1个答案

太叔航
2023-03-14

现在是2018年。在Javascript中自动导入不需要任何扩展(只要jsconfig.json文件中有checkjs:true)和typescript。

有两种类型的自动导入:add missing import快速修复,它在错误时显示为灯泡:

并对汽车进口提出建议。这些会在您键入时显示一个建议项。接受自动导入建议会自动将导入添加到文件的顶部

 类似资料:
  • 每个页面只会导入import中绑定以及被用到的代码. 也就是说并不会加载不需要的代码! import cowsay from 'cowsay-browser' export default () => <pre> {cowsay.say({ text: 'hi there!' })} </pre>

  • 我想缩进VisualStudio代码中的特定代码段。 我读了如何在Visual Studio Code中格式化代码?这提供了缩进整个代码的快捷方式,但在选择特定代码部分时不起作用。 在我的代码中选择了一些行后,我尝试了CtrlShiftF,但是整个文件是缩进的。我在Windows上使用Visual Studio Code Insider 1.8.0。我怎么能做到呢?

  • 例如,在node.js源文件的顶部: …或未使用的局部变量等。

  • 我遵循以下指示https://code.visualstudio.com/docs/setup/mac但我没有成功。这就是我进去时发生的事情 我得到了以下信息: 我还查找了以下问题:如何在OSX上从命令行打开Visual Studio代码?,这没用。 我在VSCode中只有一个终端选项,zsh。

  • 我正在学习Visual Studio Code上的Java。我已经在其中安装了"Microsoft扩展Java"。我的基本Java程序运行良好,无需软件包声明。但我想打包我的程序。如何? 早些时候我用了“IntelliJ IDEA”。我曾经启动一个新项目并声明“package com.java.learn”。在VisualStudio代码中,没有创建新java项目的选项。有一个创建工作区的选项,但

  • 概述 毫末科技的前端代码自动化的技术栈为: 制作前端组件:imgcook 前端组件文档:storybook 前端组件仓库:bit(bit.dev) 前端组件快速引入项目:xmind2code(毫末自研) + ice 组件编写规范见: 毫末xmind2code封装uniapp组件规范 其他相关技术 开源xLayers  商业Supernova  教程 imgcook 请见官方文档