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

js canvas implements verification code and obtains verification code function

This article example shares the specific code of ...

Use of provide and inject in Vue3

1. Explanation of provide and inject Provide and ...

Example of using UserMap in IMG

usemap is an attribute of the <img> tag, use...

Implementing timed page refresh or redirect based on meta

Use meta to implement timed refresh or jump of th...

How to dynamically modify container port mapping in Docker

Preface: Docker port mapping is often done by map...

How to use jsonp in vue

Table of contents 1. Introduction 2. Installation...

Detailed explanation of Tomcat configuration and optimization solutions

Service.xml The Server.xml configuration file is ...

Tutorial on installing nginx in Linux environment

Table of contents 1. Install the required environ...

JavaScript to achieve custom scroll bar effect

In actual projects, the up and down scroll bars a...

CSS Viewport Units for Fast Layout

CSS Viewport units have been around for the past ...

Detailed explanation of nginx anti-hotlink and anti-crawler configuration

Create a new configuration file (for example, go ...

Superficial Web Design

<br />I have always believed that Yahoo'...

How to build ssh service based on golang image in docker

The following is the code for building an ssh ser...

Example of viewing and modifying MySQL transaction isolation level

Check the transaction isolation level In MySQL, y...

Basic JSON Operation Guide in MySQL 5.7

Preface Because of project needs, the storage fie...