I'm trying to align some assignments to improve readability, but each time I paste something, Visual Studio 2013 automatically removes the extra spaces before the =
.
For example, this:
static class Constants {
public static string Something = "A value";
public static string SomethingElse = "Another value";
}
gets re-formatted like this:
static class Constants {
public static string Something = "A value";
public static string SomethingElse = "Another value";
}
Is there a way to turn this off?
If you are using ReSharper auto-formatting features, we recommend that you disable Visual Studio auto-formatting. You can do it in Visual Studio options (Tools | Options). For C# for example, clear the corresponding check-boxes on the Text Editor | C# | Code Style | Formatting | General options page.
Well, place the cursor into the line from where you want to clean it up and then navigate to Edit -> Advanced -> Delete Horizontal White Space or press Ctrl + E , \ . That will automatically remove the additional spaces from your code.
To access this options page, choose Tools > Options from the menu bar. In the Options dialog box, choose Text Editor > C# > Code Style > Formatting.
This can be turned off in Tools->Options->Text Editor->C#->Formatting->Spacing
via the "Ignore spaces in declaration statements" option.
VB.net for VisualStudio 2016 instructions:
|<-- main menu bar -->|<------------Side Panel Of Options Window------>|
Tools --> Options --> | Text Editor v | --> | Basic v | --> | Advanced |
Options.Advanced window:
=========================================================
= +----Highlighting-------------------------------+ =
= | (...) | =
= +-----------------------------------------------+ =
= =
= +----Outlining----------------------------------+ =
= | (...) | =
= +-----------------------------------------------+ =
= =
= +----Editor Help--------------------------------+ =
= | | =
= | [ ] Pretty listing (reformatting) of code | =
= | | =
= +-----------------------------------------------+ =
=========================================================
Screen shot:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With