

"Starting in Visual Studio 2022 17.1 Preview 2, developers can now perform Code Cleanup automatically when a file is being saved!" said Microsoft product manager Denizhan Yigitbas in a Jan. Now, the functionality is baked into the company's flagship IDE for the first time, though one has to delve into the preview channel to use it right now.

"This extension will perform the Code Cleanup automatically when the file is being saved." It sports more than 30,000 installs and earned a perfect 5 rating from 12 developers who reviewed it. "Code Cleanup is a new feature of Visual Studio 2019 that will automatically clean up your code file to make sure it is formatted correctly and that your coding style preferences are applied," the marketplace description says. "Code Cleanup On Save" has actually been available for a while also, thanks to a Visual Studio Marketplace extension appropriately called Code Cleanup On Save, authored by Microsoft extension guru Mads Kristensen. editorconfig file exists for the project, those are the settings that take precedence." Microsoft documentation from August 2021 says: "For C# code files, Visual Studio 2019 has a Code Cleanup button at the bottom of the editor (keyboard: Ctrl+K, Ctrl+E) to apply code styles from an EditorConfig file or from the Code Style options page. It lets developers configure code styles they want to apply by choosing one of two profiles in the Configure Code Cleanup dialog box.

One nifty little feature in the brand-new Visual Studio 2022 17.1 Preview 2 is automatic Code Cleanup on Save.Ĭode Cleanup was actually introduced way back in 2018 with Visual Studio 2019 Preview 1.
