VSCode自动导入错误的路径

时间:2018-04-13 06:47:35

标签: angular visual-studio-code auto-import

我在vscode中启动Angular 5项目,但是自动导入无法按预期工作,是否有任何解决方法?

而不是导入此

import { FormsModule } from '@angular/forms/src/form_providers';

可以改变这个

import { FormsModule } from '@angular/forms'

这是我的扩展名单......

enter image description here

enter image description here

这是建议如何显示..,我已经尝试了所有选项

enter image description here

我的package.json

{
  "name": "dating-app.spa",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "bootstrap": "^4.0.0",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "~1.7.4",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.6.1"
  }
}

编辑1

现在它正在运行,没有从上面的操作中做任何事情,只需离开并再试一次(无需重启计算机)今天早上。

VSCode - 版本1.22.2(1.22.2)

Node.JS - v9.11.1

Angular CLI - v1.7.4

TypeScript - v2.6.1(在项目中使用本地版本,可以切换版本)

编辑2

重新启动后,它不再工作了。它导入的是错误的。

0 个答案:

没有答案