angular: bug(language-service) components told as not included until restart

I’m submitting a …

[X] bug report

Current behavior I’m using @angular/language-service directly from TypeScript 2.2 and 2.3 language service extension, with that line in tsconfig.json : "plugins": [{ "name": "@angular/language-service" }]

When creating a new component and declaring it in some module (manually or with ng g component test) @angular/language-service raises an error, telling :

[ts] Component 'TestComponent' is not included in a module and will not be available inside a template.

But it is. The app works very well in the browser. The only way to get rid of the error is to restart the editor (VS Code in my case).

I use the language service in my courses, to help the students, and it’s a blocking issue, as it confuses them instead of helping them. And it’s blocking for everyone, as we can’t seriously restart our editor each time we create a component.

Same for services and others.

Another consequence of this : the new component is not suggested by Intellisense in other templates.

Expected behavior Declared components (and others) should not raise an error. @angular/language-service should keep its internal check up to date in real time to know what is declared or not.

And Intellisense should be up to date in real time too.

  • Angular version: 4.0.0-rc.2

  • Language: TypeScript 2.2.1 and 2.3.0-dev.20170306

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 32 (21 by maintainers)

Most upvoted comments

Hello, the problems is still there with WebStorm 2017.3.3 Build #WS-173.4301.22, built on January 15, 2018 JRE: 1.8.0_152-release-1024-b11 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.13.2

I also have the same issue:

IntelliJ IDEA 2018.2.3 (Ultimate Edition) Build #IU-182.4323.46, built on September 3, 2018 JRE: 1.8.0_152-release-1248-b8 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.11.6

@kyliau Tested with Angular 5.2, TypeScript 2.5.3, and language service as a TypeScript plugin in tsconfig.json, and the problem is still there. 😦

#21337 fixed this in 5.2.1. Finally! Thanks!

For everyone : it now means you can use the language service directly as a TS plugin, without a VS Code extension, which should be much faster !

Note the language service is currently broken in TS 2.6 (see #21591)

Sorry. I misunderstood how you are using this.

We will be fixing this for 4.0.1.

I am planning on doing significant upgrades to the vscode plugin after 4.0.0 lands to fix a number of the outstanding issues including the freezing.

The work that is slated for 4.1 is improving the API that editor integrators use to incorporate the language service into new editors (which I mistakenly thought you were doing).