December 9th, 2024

Keep working with non-blocking Code Cleanup

Leah Tran
Product Manager

Are you tired of waiting for Code Cleanup to finish every time you save your work? Visual Studio 2022 will no longer lock up and get in the way of your tasks as it’s cleaning up the code under the covers.

Image async code cleanup on save

Every developer knows the importance of maintaining clean code. However, the traditional Code Cleanup process in Visual Studio could take a while to run and lock up the entire IDE, which made it inappropriate to run on save for all scenarios. These interruptions could break your flow and slow down your development progress.

Now, when you save your work, Code Cleanup can run seamlessly in the background without interrupting your workflow.

Background cleanup for uninterrupted coding

With this enhancement enabled, the cleanup process runs quietly in the background without locking up the IDE. This means no more waiting for the cleanup to be completed before resuming your work, whether that’s opening tools or navigating around to different files in your codebase. Your IDE stays fully responsive, ensuring a smoother and more efficient user experience.

Automatic cancellation for real-time adjustments

Need to make a quick edit, but Code Cleanup started up after you saved? When the editor detects typing, the cleanup process stops. Simply save again to restart cleanup on the updated code. This ensures that you can stay in your workflow and make changes to your code without any worries.

Setting up Code Cleanup on save

To enable Code Cleanup on save, navigate to Tools > Options > Text Editor > Code Cleanup. Turn on the option Run Code Cleanup profile on Save and choose your desired profile.

Second item in Options window shows checkbox for Run Code Cleanup profile on Save

Thank you for your feedback

We continuously strive to enhance your development experience based on your invaluable feedback. These updates to the Code Cleanup feature are a testament to our commitment to making Visual Studio the best it can be. Your insights drive our innovations, and we appreciate your continuous support.

Author

Leah Tran
Product Manager