In Visual Studio Express For Web 2012 if razor view is formatted, formatter adds extra spaces or tabs to end of javascript string.
This corrupts entered code. How to prevent this corruption?
Before formatting:
@if (!(Model.Entity is Palk) && Model.Entity.CanInsert && !Model.IsNew()) {<input type="button" id="add_grid_top" class='button' value='@I("Lisa")' title='@(I("Lisa dokument") + " (Ctrl+N)")' onclick="javascript:replaceTab( 'Detail?' +$.param({ _entity:'@Model.FormName', _vmnr: @Model.Vmnr }))" /> }
After pressing Ctrl+K Ctrl+D
@if (!(Model.Entity is Palk) && Model.Entity.CanInsert && !Model.IsNew()) {<input type="button" id="add_grid_top" class='button' value='@I("Lisa")' title='@(I("Lisa dokument") + " (Ctrl+N)")' onclick="javascript:replaceTab( 'Detail?' +$.param({ _entity:'@Model.FormName ', _vmnr: @Model.Vmnr }))" /> }
Note that string
is formatted to
trailing spaces (or tabes are added).
ASP.NET MVC3, C# and Microsoft Visual Studio Express For Web 2012 are used.
I tried to change
Tools / Options / Text Editor / HTML / Tabs settings but problem persist.
In Tab window Indenting does not change behaviour. If Keep tabs is selected, two tabs are inserted after FormName. If Insert spaces is selected, 8 spaces are inserted to after FormName.
I unchecked also some options in Formatting tab but this does not cause any changes.
Posted also in http://stackoverflow.com/questions/17014311/how-to-avoid-string-corruption-on-formatting-razor-views