Home > Blockchain >  How to apply format when saving in Visual Studio 2022?
How to apply format when saving in Visual Studio 2022?

Time:06-01

I have placed a .clang-format file in my project and can apply the formatting with Ctrl K, Ctrl D. I have also configured and enabled "Run Code Cleanup profile on Save" under Options -> Text Editor -> Code Cleanup. But when I save a file, the formatting is not applied.

Is there something I'm missing?

Thank you in advance!

CodePudding user response:

use prettier extension and use the shorcut alt shift f to apply the code formatting before you save.

CodePudding user response:

Unfortunately, Code Cleanup only applies to C# and VB.Net, and not to C code.

From MS documentation

For C# code, you can also configure Visual Studio to apply these code style preferences using the Code Cleanup

  • Related