Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I save file, why Visual Studio Code does format my file?

Good Day!

Help me, please.

This is My code. When I click CTRL+S, or click "Save All", or "Save", My Visual Studio Code format my all documents like ALT+SHIFT+F... But, I didnt click this fuction. And my CSS, or HTML code after Click button "Save". How can you see, my big code Looks terrible. How to remove this function?

Thank you in advance.

like image 267
Soa Soa Avatar asked Jul 01 '17 22:07

Soa Soa


People also ask

How do I turn off auto format in Visual Studio?

The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF. Save this answer.

How do I fix formatting in Visual Studio?

As long as your code is syntactically correct (i.e. no stray brackets or End Ifs without matching Ifs), Visual Studio will reformat your whole file with one key chord: Hold down the Control key and then press K, followed by D. Boom! Everything looks pretty again.

How do you correct formatting in VS Code?

VS Code has great support for source code formatting. The editor has two explicit format actions: Format Document (Ctrl+Shift+I) - Format the entire active file. Format Selection (Ctrl+K Ctrl+F) - Format the selected text.


2 Answers

I had this same issue and that problem is caused by the extension "JS-CSS-HTML Formatter".I uninstalled it and then it works! Hope it helps someone!

like image 70
Ramya S Avatar answered Sep 19 '22 03:09

Ramya S


Go to setting (Ctrl + ,) and change editor.formatOnSave from true to false: "editor.formatOnSave": false,

like image 26
autosvet Avatar answered Sep 20 '22 03:09

autosvet