I have
Ctrl + K, Ctrl + F
to format the selected text
or
Ctrl+ K, + Ctrl + D for the document :
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I remember I had an automatic code formating right after I pressed ctrl+s.
Now I don't have that.
All I have is "Code Formatter" that makes a lot of commets which I don't need and when I remove those comments with "Clear Comments" it will remove my personal commets also.
Will be super glad for help here.
I have
Ctrl + K, Ctrl + F
to format the selected text
or
Ctrl+ K, + Ctrl + D for the document :
You may of used Format Document on Save Visual Studio extension.
Enables auto formatting of the code when you save a file. Visual Studio supports auto formatting of the code with the CTRL+E,D or CTRL+E,F key shortcuts but with this extension the command 'Format Document' is executed on Save.
Hi, @Elado
Welcome to Microsoft Q&A!
To format a selection: Ctrl+K, Ctrl+F
To format a document: Ctrl+K, Ctrl+D
See the pre-defined keyboard shortcuts. (These two are Edit.FormatSelection and Edit.FormatDocument.)
*
Update:
You can Identify and customize keyboard shortcuts in Visual Studio.
Sincerely,
Peng
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread
Here's the extension I use to format documents on save:
https://marketplace.visualstudio.com/items?itemName=MadsKristensen.CodeCleanupOnSave
You should have a default Code Cleanup profile if you go to "Analyze > Code Cleanup > Configure Code Cleanup"
If you move "Format document" from "Available fixers" to "Included fixer" (if it's not already) then press "Ok" and it should format your documents based on your preferences.
There are a few fixers I use that are quite handy (Sort usings/Remove unnecessary usings probably the most useful to me):
The Code Formatter is a 3rd party Visual Studio plugin. Read the openly published documentation to see if this feature is available?