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

No more completion for components / HTML tags in Ivy mode #1140

Closed
cyrilletuzi opened this issue Feb 22, 2021 · 5 comments · Fixed by ngstack/translate#644 or sublimelsp/LSP-angular#29
Labels

Comments

@cyrilletuzi
Copy link

cyrilletuzi commented Feb 22, 2021

Describe the bug

When enabling the Ivy language service, there is no more components / HTML tags completion/suggestions at all.

To Reproduce

Steps to reproduce the behavior:

  1. npm i @angular/cli -g
  2. ng new demo --inline-template (and say "Yes" to strict mode)
  3. cd demo
  4. code .
  5. Enable extension's Ivy mode when proposed
  6. Try writing any HTML tag in AppComponent template: no autocomplete at all
  7. ng g component demo
  8. Try writing <app-de in AppComponent template: no autocomplete at all (but if I manually write the full tag, the language service is OK with it)

Note: there is the same issue with external templates (in this case you have HTML tags autocomplete because it's a HTML file, but you have no more components tags autocomplete).

Expected behavior

Components / HTML tags should be suggested.

Logs

[Info  - 4:44:27 PM] Angular language server process ID: 6223
[Info  - 4:44:27 PM] Using typescript/lib/tsserverlibrary v4.1.5 from /Users/xxx/.vscode/extensions/angular.ng-template-11.2.2/node_modules/typescript/lib/tsserverlibrary.js
[Info  - 4:44:27 PM] Using @angular/language-service/bundles/ivy v11.2.1 from /Users/xxx/.vscode/extensions/angular.ng-template-11.2.2/node_modules/@angular/language-service/bundles/ivy.js
[Info  - 4:44:27 PM] Log file: /Users/xxx/Library/Application Support/Code/logs/20210222T163701/exthost1/Angular.ng-template/nglangsvc.log
[Info  - 4:44:30 PM] Enabling Ivy language service for /Users/xxx/xxx/xxx/lsivyissue/tsconfig.json.

The log file is empty.

Additional context

VS Code version: 1.53.2
Extension and Angular project version: 11.2.2
OS: macOS 11.2.1 (Intel)
No other extension.

@reed-lawrence
Copy link

reed-lawrence commented Feb 22, 2021

+1

I have the same issue. As a quick fix, disabling the experimental Ivy features in VS Code settings, the completion returns to expected behavior.

@CthulhuOfStars
Copy link

Same behavior + always crash

Thanks

@jpike88
Copy link

jpike88 commented Feb 25, 2021

Same problem, enabling the ivy engine makes it no longer recognise component tags, something is broken

@tnastula
Copy link

Same problem. @reed-lawrence suggested good temporary solution.

atscott added a commit to atscott/angular that referenced this issue Mar 2, 2021
The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of angular/vscode-ng-language-service#1140
atscott added a commit to atscott/angular that referenced this issue Mar 2, 2021
The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of angular/vscode-ng-language-service#1140
atscott added a commit to atscott/angular that referenced this issue Mar 2, 2021
The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of angular/vscode-ng-language-service#1140
atscott added a commit to atscott/angular that referenced this issue Mar 2, 2021
The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of angular/vscode-ng-language-service#1140
atscott added a commit to atscott/angular that referenced this issue Mar 3, 2021
An opening tag `<` without any characters after it is interperted as a
text node (just a "less than" character) rather than the start of an
element in the template AST. This commit adjusts the autocomplete engine
to provide element autocompletions when the nearest character to the
left of the cursor is `<`.

Note that this also allows for spaces between
the `<` so `<     ¦` will also provide element autocomplete, much like
other extensions such as Emmet.

Part of the fix for angular/vscode-ng-language-service#1140
atscott added a commit to atscott/angular that referenced this issue Mar 3, 2021
…sion for LS

The current logic in the compiler is to bail when there are errors when
parsing a template into an HTML AST or when there are errors in the i18n
metadata. As a result, a template with these types of parse errors
_will not have any information for the language service_. This is because we
never attempt to conver the HTML AST to a template AST in these
scenarios, so there are no template AST nodes for the language service
to look at for information. In addition, this also means that the errors
are never displayed in the template to the user because there are no
nodes to map the error to.

This commit adds an option to the template parser to temporarily ignore
the html parse and i18n meta errors and always perform the template AST
conversion. At the end, the i18n and HTML parse errors are appended to
the returned errors list. While this seems risky, it at least provides
us with more information than we had before (which was 0) and it's only
done in the context of the language service, when the compiler is
configured to use poisoned data (HTML parse and i18n meta errors can be
interpreted as a "poisoned" template).

fixes angular/vscode-ng-language-service#1140
zarend pushed a commit to angular/angular that referenced this issue Mar 3, 2021
…le (#41054)

The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of angular/vscode-ng-language-service#1140

PR Close #41054
zarend pushed a commit to angular/angular that referenced this issue Mar 3, 2021
…le (#41054)

The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of angular/vscode-ng-language-service#1140

PR Close #41054
atscott added a commit to atscott/angular that referenced this issue Mar 3, 2021
An opening tag `<` without any characters after it is interperted as a
text node (just a "less than" character) rather than the start of an
element in the template AST. This commit adjusts the autocomplete engine
to provide element autocompletions when the nearest character to the
left of the cursor is `<`.

Part of the fix for angular/vscode-ng-language-service#1140
atscott added a commit to atscott/angular that referenced this issue Mar 3, 2021
…sion for LS

The current logic in the compiler is to bail when there are errors when
parsing a template into an HTML AST or when there are errors in the i18n
metadata. As a result, a template with these types of parse errors
_will not have any information for the language service_. This is because we
never attempt to conver the HTML AST to a template AST in these
scenarios, so there are no template AST nodes for the language service
to look at for information. In addition, this also means that the errors
are never displayed in the template to the user because there are no
nodes to map the error to.

This commit adds an option to the template parser to temporarily ignore
the html parse and i18n meta errors and always perform the template AST
conversion. At the end, the i18n and HTML parse errors are appended to
the returned errors list. While this seems risky, it at least provides
us with more information than we had before (which was 0) and it's only
done in the context of the language service, when the compiler is
configured to use poisoned data (HTML parse and i18n meta errors can be
interpreted as a "poisoned" template).

fixes angular/vscode-ng-language-service#1140
zarend pushed a commit to angular/angular that referenced this issue Mar 3, 2021
…41068)

An opening tag `<` without any characters after it is interperted as a
text node (just a "less than" character) rather than the start of an
element in the template AST. This commit adjusts the autocomplete engine
to provide element autocompletions when the nearest character to the
left of the cursor is `<`.

Part of the fix for angular/vscode-ng-language-service#1140

PR Close #41068
zarend pushed a commit to angular/angular that referenced this issue Mar 3, 2021
…sion for LS (#41068)

The current logic in the compiler is to bail when there are errors when
parsing a template into an HTML AST or when there are errors in the i18n
metadata. As a result, a template with these types of parse errors
_will not have any information for the language service_. This is because we
never attempt to conver the HTML AST to a template AST in these
scenarios, so there are no template AST nodes for the language service
to look at for information. In addition, this also means that the errors
are never displayed in the template to the user because there are no
nodes to map the error to.

This commit adds an option to the template parser to temporarily ignore
the html parse and i18n meta errors and always perform the template AST
conversion. At the end, the i18n and HTML parse errors are appended to
the returned errors list. While this seems risky, it at least provides
us with more information than we had before (which was 0) and it's only
done in the context of the language service, when the compiler is
configured to use poisoned data (HTML parse and i18n meta errors can be
interpreted as a "poisoned" template).

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

PR Close #41068
zarend pushed a commit to angular/angular that referenced this issue Mar 3, 2021
…41068)

An opening tag `<` without any characters after it is interperted as a
text node (just a "less than" character) rather than the start of an
element in the template AST. This commit adjusts the autocomplete engine
to provide element autocompletions when the nearest character to the
left of the cursor is `<`.

Part of the fix for angular/vscode-ng-language-service#1140

PR Close #41068
@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 Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.