简体   繁体   中英

How does WebStorm recognize Angular language service?

I am building an Angular project since the 2.beta. I was happy to find out that WebStorm is supporting the Angular language service later on. But I cant get it to work in my project.

If I create a new project using the angular-cli, WebStorm works perfectly and supports it. But I cant get it work with my older project, even though I am running all @angular-packages on version 4.3.5 by now.

I tried to activate it by using "Settings -> Languages & Frameworks -> Typescript -> use TypeScript Service", but the checkbox does not show up.

It says in the documentation that you just need the language-service installed as dev-dependency and have a (any?) tsconfig.json.

Here is my tsconfig.json:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "module": "es2015",
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": false,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  },
  "include": [
    "src"
  ],
  "exclude": [
    "node_modules"
  ]
}

I guess the documentation doesn't mention more on this, since it works out of the box most of the time...

I was facing the same issue on a couple of projects. Even for some of them it was working when I've created the project but after a while stopped working. Today I've discovered why... If you exclude your node_modules folder from your project, it will stop working.

How can you re-enable it? Right click on the node_modules folder, then Mark Directory As and choose Not Excluded . After the indexing process is finished, language service should work!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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