Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Format component attributes next line in Visual Studio Code

Is there any way we can set the VS code formatter to format components in Angular 2+ templates to wrap attributes in a new line. I want it to be this format:

  <app 
    [input1]="input1$ | async" 
    [input2]="input2$ | async" 
    (inputChanged)="setInput(input)">
  </app>

It would be nice for us to have auto-format on and have them format this way. React has something similar for wrapping JSX attributes in the next line and aligning them.

like image 933
Daniel Park Avatar asked Sep 05 '26 04:09

Daniel Park


1 Answers

In vscode(1.27.2), press ctrl+shift+p and type open user settings then go to user setting file and add "html.format.wrapAttributes": "force-aligned" command.

like image 174
baj9032 Avatar answered Sep 06 '26 16:09

baj9032



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!