Vscode: HTML Wrap attributes doesn't work

Created on 27 Apr 2017  路  3Comments  路  Source: microsoft/vscode

On HTML (in our case, Angular Component html), auto formatter (ALT + SHIFT + F on windows) does not wrap attributes to new line even if the param is set to force in settings.

  • VSCode Version: 1.11.2
  • OS Version: Win 10

Steps to Reproduce:

  1. Set "html.format.wrapAttributes": "force" in user settings
  2. Create a file with this HTML:
<button class="btn btn-secondary custom-btn" (click)="myGreatAndSuperMethod.show();" title="The very long title of my button" type="button">
   <i class="fa fa-refresh" aria-hidden="true"></i>
</button>

It doesn't wrap attributes. I expected to have:

<button class="btn btn-secondary custom-btn"
  (click)="myGreatAndSuperMethod.show();"
  title="The very long title of my button"
  type="button">
   <i class="fa fa-refresh" aria-hidden="true"></i>
</button>

Worst, if HTML has already wrapped attributes, it replace them on the same line.

Is the setting still used?

html needs more info

Most helpful comment

I uninstall extension: Beautify and then "wrapAttributes": "force-aligned" works.

All 3 comments

I tried your example in 1.11.2 and I get

<button class="btn btn-secondary custom-btn"
    (click)="myGreatAndSuperMethod.show();"
    title="The very long title of my button"
    type="button">
   <i class="fa fa-refresh" aria-hidden="true"></i>
</button>

Can you start code with code --disable-extensions to see if this is caused by a extension?

Also check if there are any html related settings such as "html.format.enable": false,
"html.format.unformatted" containing 'button' that could cause this.

I uninstall extension: Beautify and then "wrapAttributes": "force-aligned" works.

Ok, running without extension solved the problem. So I'll try to re-enable them one by one. Thanks for help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipgiuliani picture philipgiuliani  路  3Comments

trstringer picture trstringer  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments

lukehoban picture lukehoban  路  3Comments

trstringer picture trstringer  路  3Comments