So I just have a beef with the way Visual Studio formats razor code. I've always had some problems with visual studio and how it formats UI code, it always seems to do a real super bad job that the industry doesn't want to follow.
So the example looks real real stupid. And I'm trying to figure out if there are mods or ways to fix this issue. It just looks real real bad.
Anyone know anything about this? lol
@using Company.Mobile2.Enums @helper BidsByShipment(string generatedId, int bidsCount, int activeBidsCount) { if (bidsCount > 0) { <a class="Company-listview-link Company-listview-bids" href="/Shipping/Bids/ByShipment?id={0}"> @if (activeBidsCount > 0) { <text>@bidsCount (@activeBidsCount @GetStr("Company"))</text> } else { <text>@bidsCount</text> } </a> } else { <text>0 @GetStr("Company")</text> } }
The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.
Auto formatting settings in Visual Studio Show activity on this post. Select the text you want to automatically indent. Click menu Edit → Advanced → *Format Selection, or press Ctrl + K , Ctrl + F . Format Selection applies the smart indenting rules for the language in which you are programming to the selected text.
Apparently there's no way around it for the moment, this is what they have answered in another related question: Why doesn't Visual Studio code formatting work properly for Razor markup?
Do you have Visual Studio set up to use tab indentation? This reveals a Razor formatting bug where it inserts spaces instead of tabs as it should. The workaround is to switch to space indentation.
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