Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 253
Martin-Mueller Avatar asked Jun 29 '26 09:06

Martin-Mueller


1 Answers

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!

like image 183
Zsolt Tolvaly Avatar answered Jun 30 '26 21:06

Zsolt Tolvaly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!