Skip to content
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

Language service crashes if there is an error during Typecheck block generation #1881

Closed
atscott opened this issue Mar 21, 2023 · 2 comments
Closed
Labels

Comments

@atscott
Copy link
Collaborator

atscott commented Mar 21, 2023

Discovered from #1840 (comment)

Steps to reproduce:

  1. In the integration test project, update the library component to use a non-exported host directive:
@Directive({standalone: true})
export class HostBindDirective {
}

@Component({
  selector: 'lib-post',
  template: '{{random}}',
  hostDirectives: [HostBindDirective],
})
export class PostComponent {
  random = Math.random();
}

(Note: also need to update the index.ts to export just PostComponent and PostModule rather than everything from the file.
2. build the integration project (yarn --cwd integration/project build)
3. Open foo.component.html - the language service will crash because the template type check block cannot import the non-exported HostBindDirective

@atscott atscott added the bug label Mar 21, 2023
atscott added a commit to atscott/angular that referenced this issue Mar 21, 2023
…ecking

This commit updates the type checking step of the compilation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Mar 21, 2023
…ecking

This commit updates the type checking step of the compilation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Mar 31, 2023
…ecking

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Apr 3, 2023
…ecking

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Apr 5, 2023
…ecking

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Apr 11, 2023
…ecking

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Apr 11, 2023
…ecking

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881
AndrewKushnir pushed a commit to angular/angular that referenced this issue Apr 11, 2023
…ecking (#49527)

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881

PR Close #49527
AndrewKushnir pushed a commit to angular/angular that referenced this issue Apr 11, 2023
…ecking (#49792)

This commit updates the type checking operation to catch
`FatalDiagnosticError` and surface them as diagnostics rather than
crashing.

Fixes angular/vscode-ng-language-service#1881

PR Close #49792
@MTstomachTM
Copy link

Hi @atscott,

I'm sorry for commenting on closed issue. But after I update my Angular Language Service to 15.2.1, Angular to 15.2.8, and the component library, Clarity Design, to the latest version that had exported previously unexported directive, the issue persist.

I set angular.trace.server: "verbose", and the last trace before the language service crash is

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<FatalDiagnosticError>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}
[Error - 4:11:36 PM] Connection to server got closed. Server will not be restarted.

Is there anything I can provide to help trace the cause?

@atscott atscott reopened this Apr 27, 2023
atscott added a commit to atscott/angular that referenced this issue Apr 27, 2023
…r components

This commit adds similar handling to what was done in angular@ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Apr 27, 2023
…r components

This commit adds similar handling to what was done in angular@ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881
atscott added a commit to atscott/angular that referenced this issue Apr 27, 2023
…r components

This commit adds similar handling to what was done in angular@ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881
pkozlowski-opensource pushed a commit to angular/angular that referenced this issue Apr 28, 2023
…r components (#50046)

This commit adds similar handling to what was done in ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881

PR Close #50046
pkozlowski-opensource pushed a commit to angular/angular that referenced this issue Apr 28, 2023
…r components (#50046)

This commit adds similar handling to what was done in ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881

PR Close #50046
sr5434 pushed a commit to sr5434/angular that referenced this issue May 3, 2023
…r components (angular#50046)

This commit adds similar handling to what was done in angular@ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881

PR Close angular#50046
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants