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

html.format.wrapAttributes: auto-force aligned? #1714

Open
demiro opened this issue Oct 8, 2019 · 1 comment
Open

html.format.wrapAttributes: auto-force aligned? #1714

demiro opened this issue Oct 8, 2019 · 1 comment

Comments

@demiro
Copy link

demiro commented Oct 8, 2019

So, formatting in HTML is kinda frustrating...

disclaimer
using VSCode

there are a lot of cases, especially in SPA's (angular, vue, etc)... where a component has many attributes...

and for me, in a scenario like this:
<mat-progress-spinner *ngIf="isSavingData" mode="indeterminate" diameter="18" color="accent"></mat-progress-spinner>

I am using html.format.wrapAttributes": "force-expand-multiline", which does the work quite well for me... where it produces:

<mat-progress-spinner
  *ngIf="isSavingData"
  mode="indeterminate"
  diameter="18"
  color="accent"
>
</mat-progress-spinner>

(except the closing tag, feel should be like
></mat-progress-spinner>

it is in the scenarios like this:

<my-comp
  class="f-panel"
  *ngIf="isFinished"
></my-comp>

... that I am frustrated. While breaking attributes in multi-line is good for the readability, it is also working against it...

this is more readable to me....

<my-comp class="f-panel" *ngIf="isFinished"></my-comp>

not only this line, but also sparing 3 other lines... which makes my code less vertically long and can see it more at the first glance...

So what I would like, and I am sure there are many others that agree with me... to have some kind of hybrid of a system...

right now the "html.format.wrapLineLength": 80, only works when the wrapAttributes is set to 'auto' ... I wish it would work with force-expand-multiline, or in this case would be names 'expand-multiline' ... or 'auto-expand-multiline' ...

so instead of going

<my-comp class="f-panel" *ngIf="isFinished"></my-comp>
<mat-progress-spinner *ngIf="isSavingData" mode="indeterminate" diameter="18"
  color="accent">
</mat-progress-spinner>

on settings

"html.format.wrapLineLength": 80,
"html.format.wrapAttributes": "auto",

it would go:

"html.format.wrapLineLength": 80,
"html.format.wrapAttributes": "auto-expand-multiline",

and would produce something like this:

<my-comp class="f-panel" *ngIf="isFinished"></my-comp>
<mat-progress-spinner
      *ngIf="isSavingData"
      mode="indeterminate"
      diameter="18"
      color="accent"
></mat-progress-spinner>

if I could get something like this, would be amazing!

Environment

OS: Windows

@bitwiseman
Copy link
Member

@demiro
See #1404.

There's discussion of how to do this better. But there's been no one with enough interest/time to do the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants