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

bug(language-service) using ngForTemplate (sugarized) with inline-template will mess-up html lint/format #839

Closed
andreElrico opened this issue Jun 4, 2020 · 6 comments · Fixed by #846
Assignees
Labels
bug extension Relates to an issue with the VS Code extension

Comments

@andreElrico
Copy link

🐞 bug report

Affected Package

?language service?

(I hope its the right repo to put this)

Is this a regression?

I think: no, not 100% sure

Description

Steps to reproduce:

  1. copy this into *.ts in vscode
@Component({
  selector: 'my-app',
  template: `
    <ng-container *ngFor="let el of [1,2,3,4]; template: myTpl">
    </ng-container>

    <ng-template let-el #myTpl>
      <p> {{el}} </p>
    </ng-template>
    
    <hr>

    <ng-template ngFor let-item="$implicit" [ngForOf]="[11,22,33,44]" [ngForTemplate]="myTpl"></ng-template>
  `,
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {}

(Stackblitz does not use language feature in inline tpl)

  • STACKBLITZ

  • When I use this in vscode its messes up the HTML linting/ styling.

🔥 Exception or Error

Messed up html

image
what it should look like (ignore red error line. There is no templateLOL input)
image

🌍 Your Environment

  • vscode Version: 1.45.1
  • Angular Language Service angular.ng-template 0.901.9

Angular Version:


Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.6
@angular-devkit/build-angular      0.901.6
@angular-devkit/build-ng-packagr   0.901.7
@angular-devkit/build-optimizer    0.901.6
@angular-devkit/build-webpack      0.901.6
@angular-devkit/core               9.1.6
@angular-devkit/schematics         9.1.6
@angular/cdk                       9.2.4
@angular/cli                       9.1.6
@angular/flex-layout               9.0.0-beta.31
@angular/material                  9.2.4
@ngtools/webpack                   9.1.6
@schematics/angular                9.1.6
@schematics/update                 0.901.6
ng-packagr                         9.1.5
rxjs                               6.5.5
typescript                         3.8.3
webpack                            4.42.0

Current workaround

use of "de-sugarized" version will not mess with linting/ formating.

<ng-template ngFor let-item="$implicit" [ngForOf]="[11,22,33,44]" [ngForTemplate]="myTpl"></ng-template>

@andreElrico andreElrico changed the title bug(language-service) bug(language-service) using ngForTemplate (sugarized) will mess-up html lint/format Jun 4, 2020
@andreElrico andreElrico changed the title bug(language-service) using ngForTemplate (sugarized) will mess-up html lint/format bug(language-service) using ngForTemplate (sugarized) with inline-template will mess-up html lint/format Jun 4, 2020
@pkozlowski-opensource
Copy link
Member

I will add screenshots if needed

Yes, please!

@andreElrico
Copy link
Author

my pleasure @pkozlowski-opensource

@andreElrico
Copy link
Author

Plot twist: Its not happening when we dont have >>: << semicolon

image

However I know this semicolon syntax from official angular material docs:

Offical Material Stackblitz

<cdk-nested-tree-node *cdkTreeNodeDef="let node; when: hasChild" class="example-tree-node">

So I still think this should be a bug :/

@kyliau kyliau transferred this issue from angular/angular Jul 1, 2020
@kyliau
Copy link
Contributor

kyliau commented Jul 1, 2020

@ayazhafiz could you please take a look at this?

@ayazhafiz
Copy link
Member

Yes, will do within the next 3 days

@ayazhafiz ayazhafiz self-assigned this Jul 1, 2020
@ayazhafiz ayazhafiz added the extension Relates to an issue with the VS Code extension label Jul 1, 2020
@kyliau kyliau added the bug label Jul 1, 2020
ayazhafiz added a commit to ayazhafiz/vscode-ng-language-service that referenced this issue Jul 6, 2020
@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 Aug 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug extension Relates to an issue with the VS Code extension
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants