Solve the problem of HTML automatic formatting after saving in vscode

Solve the problem of HTML automatic formatting after saving in vscode

The version of vsCode has been updated in recent days, and the current version number is: 1.43. In fact, I didn’t feel any obvious changes every time I updated the vsCode version number. I just updated it as a daily routine. And this time vsCode really helped me a lot.

As we all know, when we write HTML pages, we often bind many attributes or events to elements. If we don’t wrap them, it will be ugly. So my daily practice is to put each attribute on a separate line, like this:

<nz-pagination 
      [nzPageIndex]="2" 
      [nzTotal]="500" 
      nzShowSizeChanger 
      nzShowQuickJumper></nz-pagination>

But after this update, when I save the HTML, it will be automatically formatted, and all the attributes will be moved to one line, like this:

<label (click)="changeItem('code')" [ngClass]="{'active': activeItem == 'code'}">Hello World</label>

I tolerated it at first, but as more and more attributes were bound to an element, I really broke down. I thought it was some plug-in that was causing the problem, but when I looked for it, it seemed that the installed plug-in did not clearly specify formatting for HTML. So I deleted all 26 of my plugins before I got angry!

But the problem was not solved. So I focused on the built-in plug-in of vscode. It turned out that after the last version update, vscode automatically ticked this option for me. . .

I hope that if you encounter this kind of problem in the future, you can check this place first to avoid the same problem as me. No more talking, I'm going to install the plug-in. . .

Summarize

This is the end of this article about solving the problem of automatic formatting of HTML after saving in vscode. For more relevant vscode HTML formatting content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  Detailed explanation of the use of Vue h function

>>:  Weather icon animation effect implemented by CSS3

Recommend

MySQL 5.7.13 installation and configuration method graphic tutorial on Mac

MySQL 5.7.13 installation tutorial for Mac, very ...

JavaScript canvas Tetris game

Tetris is a very classic little game, and I also ...

Detailed explanation of nginx-naxsi whitelist rules

Whitelist rule syntax: BasicRule wl:ID [negative]...

Using react-beautiful-dnd to implement drag and drop between lists

Table of contents Why choose react-beautiful-dnd ...

Teach you step by step to configure MySQL remote access

Preface When using the MySQL database, sometimes ...

Detailed description of the use of advanced configuration of Firewalld in Linux

IP masquerading and port forwarding Firewalld sup...

Native js to implement a simple calculator

This article example shares the specific code of ...

Summary of the unknown usage of "!" in Linux

Preface In fact, the humble "!" has man...

SQL query for users who have logged in for at least n consecutive days

Take 3 consecutive days as an example, using the ...

MySQL database basic syntax and operation

MySQL database basic syntax DDL Operations Create...

A brief discussion on the correct approach to MySQL table space recovery

Table of contents Preliminary Notes Problem Repro...

How to change MySQL character set utf8 to utf8mb4

For MySQL 5.5, if the character set is not set, t...

MySQL password is correct but cannot log in locally -1045

MySQL password is correct but cannot log in local...