【问题标题】:Angular 2 code suggestions on IntelliJIntelliJ 上的 Angular 2 代码建议
【发布时间】:2017-01-06 14:25:09
【问题描述】:

我看到Angular2 RC这个月早些时候发布了,我玩了几个月的beta版本,所以我决定删除angular2 beta模块

npm uninstall angular2

然后我使用了 angular2 快速入门教程中的 package.json 来安装 RC 版本:

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common":  "2.0.0-rc.1",
    "@angular/compiler":  "2.0.0-rc.1",
    "@angular/core":  "2.0.0-rc.1",
    "@angular/http":  "2.0.0-rc.1",
    "@angular/platform-browser":  "2.0.0-rc.1",
    "@angular/platform-browser-dynamic":  "2.0.0-rc.1",
    "@angular/router":  "2.0.0-rc.1",
    "@angular/router-deprecated":  "2.0.0-rc.1",
    "@angular/upgrade":  "2.0.0-rc.1",

    "systemjs": "0.19.27",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",

    "angular2-in-memory-web-api": "0.0.7",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^0.8.1"
  }
}

经过一些导入重写后,我的应用程序运行良好,但现在,我的 IDE 上的 Angular 框架不再具有自动完成功能。

例如,IntelliJ 无法识别我的模板中的 *ngIf 指令

这是我的 tsconfig.json :

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

我是否需要配置其他东西才能让它再次工作?

感谢您的回答

【问题讨论】:

  • 您真的在使用 intellij-14,还是使用了错误的标签?如果是的话,我不会对 ng2 支持抱太大希望 - 这仍然在最前沿 (2016.x) 版本中融合在一起
  • 我推荐 WebStorm 用于 Angular2 开发。它来自与 IntelliJ 相同的开发人员,但 WebStorm 支持 Angular2 + Typescript。
  • @Patrick2607 - IntelliJ 是所有 Jetbrains IDE 的超集。即 WebStorm、Pycharm 等的全部功能。人。可以通过插件集成到 IntelliJ 中。
  • angular 已更新让我们等待 webstrom 更新它甚至不允许 *ngFor ,(提交)等

标签: intellij-idea autocomplete typescript angular


【解决方案1】:

根据comment in the IntelliJ bug tracker,修复了 2016.1.2 EAP 中的问题。我更新到 2016.1.3 EAP,或更具体地说:

IntelliJ IDEA (Minerva) IU-145.1503.17
Build #IU-145.1503, built on May 20, 2016

它为我解决了这个问题。

【讨论】:

    【解决方案2】:

    我建议使用 Jetbrains 的以网络为中心的 IDE WebStorm。它对 Angular 2 提供了开箱即用的支持,甚至还有用于运行 npm 脚本的精美界面。

    https://www.jetbrains.com/webstorm

    【讨论】:

      【解决方案3】:

      你可以试试ang2-autocomplete 这是使用示例:plnkr.co/edit/5zRD0fcOZHXEMOk4kupY?p=preview

      【讨论】:

      • 我认为作者希望使用不在前端 Web 代码/浏览器中的 IDE 自动完成:-/
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-05
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多