Home > Enterprise >  How to auto format code when type semicolon in VSCode
How to auto format code when type semicolon in VSCode

Time:01-24

I want type semicolon and then auto format code look like Visual studio.

Look like this enter image description here

don't this enter image description here

CodePudding user response:

I assume you are using VSCode given the tag you added to your post. With this information, I would suggest you look into the "Format on type" property in the settings of VSCode. First, to enter the settings you do the following:

File > Preferences > Settings

Then you look up in the search bar "format on type" and you should see the next option available:

Editor: Format on type
☐ Controls whether the editor should automatically format the line after typing.

It may be language dependent how well it works, and it could be affected by linting extensions. I hope it helped!

Extra information:

  •  Tags:  
  • Related