-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSCode Angular language-service mark template errors in TypeScript file #41032
Labels
area: language-service
Issues related to Angular's VS Code language service
P2
The issue is important to a large percentage of users, with a workaround
Milestone
Comments
alxhub
added a commit
to alxhub/angular
that referenced
this issue
Mar 3, 2021
… files The compiler considers template diagnostics to "belong" to the source file of the component using the template. This means that when diagnostics for a source file are reported, it returns diagnostics of TS structures in the actual source file, diagnostics for any inline templates, and diagnostics of any external templates. The Language Service uses a different model, and wants to show template diagnostics in the actual .html file. Thus, it's not necessary (and in fact incorrect) to include such diagnostics for the actual .ts file as well. Doing this currently causes a bug where external diagnostics appear in the TS file with "random" source spans. This commit changes the Language Service to filter the set of diagnostics returned by the compiler and only include those diagnostics with spans actually within the .ts file itself. Fixes angular#41032
zarend
pushed a commit
that referenced
this issue
Mar 3, 2021
… files (#41070) The compiler considers template diagnostics to "belong" to the source file of the component using the template. This means that when diagnostics for a source file are reported, it returns diagnostics of TS structures in the actual source file, diagnostics for any inline templates, and diagnostics of any external templates. The Language Service uses a different model, and wants to show template diagnostics in the actual .html file. Thus, it's not necessary (and in fact incorrect) to include such diagnostics for the actual .ts file as well. Doing this currently causes a bug where external diagnostics appear in the TS file with "random" source spans. This commit changes the Language Service to filter the set of diagnostics returned by the compiler and only include those diagnostics with spans actually within the .ts file itself. Fixes #41032 PR Close #41070
This was referenced Mar 8, 2021
Closed
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: language-service
Issues related to Angular's VS Code language service
P2
The issue is important to a large percentage of users, with a workaround
🐞 bug report
Affected Package
The issue is caused by package @angular/language-service
Is this a regression?
I don't know, the issue has been present for some time.
Description
When I open typescrtipt files I see these errors:
Both errors should be present in the HTML template, not in the TypeScript code, and it's very annoying.
🔬 Minimal Reproduction
I tried to create a reprodction, but it came out of unknown reason. If I copy-paste my codes to StackBlitz the issue isn't shown.
Instead of this I shared some printscreens above.
🔥 Exception or Error
See above on printscreens.
🌍 Your Environment
Angular Version:
Anything else relevant?
The text was updated successfully, but these errors were encountered: