Search code examples
visual-studioide

How do I get Visual Studio, Code Clean Up to remove White Spaces?


How do I get Code Cleanup to Remove these White Spaces. (See Screenshot 1)

I Searched all the Remove .... options and there is none for remove White Spaces. (See Screenshot 2)

Thank you

Sweep

Cleanup Options

I also tried Format Document and it did nothing. Thank you again.

I appreciate it.


Solution

  • After some searching, like remove White Spaces/remove empty lines this feature isn't implemented in the same way in Visual Studio.

    As a workaround, you can use shortcut to achieve it.

    1.Open Tools > Options->Environment tab > Keyboard

    2.Search for DeleteBlank and select Edit.DeleteBlankLines

    3.Add a new shortcut for example Ctrl+D,Ctrl+E

    4.Assign > OK

    5.Select all text and hit the shortcut

    Besides, i suggest you can submit a feature request on Visual Studio Forum. That will allow you to directly interact with the appropriate product group, and make it more convenient for the product group to collect and categorize your suggestions.