Is there a way to disable ReSharper Web Form / MVC formatting formatting (.aspx) when the blake (}) completes?

Is there a way to disable ReSharper Web Form / MVC code formatting (.aspx) in parenthesis mode ( } )?

This is really frustrating, and most of the time I don't want it. For example, if I have:

 <% if (CurrentUser.IsRole(Helper.UserRole.Agent)) { %> <%= Html.LinkTo("sign out", SessionRoutes.Logout, null, new { @class = "sign" }) %> <% } else { %> ... <% } %> 

as soon as I type the last <% } , it is formatted as follows:

 <% if (CurrentUser.IsRole(Helper.UserRole.Agent)) { %> <%= Html.LinkTo("sign out", SessionRoutes.Logout, null, new { @class = "sign" })%> <% } else {%> <% }%> 

I looked at the ReSharper options, but I can not find a suitable setting. It drives me crazy! To get around this, I need to either insert a bracket, sometimes just get lucky that ctrl + z works or types <{ , then inserts % then space: S

I'm sure someone who has worked with ReSharper and web forms will know what I'm talking about lately.

thanks

+4
source share
3 answers

First, you must change the shape layout options to suit your style. Go to ReSharper | Options> Languages> C #> Formatting style> Layout layout> Braces Layout and the option to change "Other" to "At the end of the line (K & R style)".

Then notice that there is actually an error that sometimes causes ReSharper to insert line breaks after <% or before%>. This bug has been fixed in internal builds and should be in the next EAP (later, 2011-jun-7), as well as in a future beta version 6.0.

If you want to completely disable autoformat in the ReSharper options (but this will affect not only ASP.NET, but also regular C # files). Go to ReSharper | Options> Editor and disable Auto-format at semicolon and Auto-format with closing bracket.

Hope this helps :)

+3
source

Are you sure formatting will do this? Visual Studio itself also has the option "Automatically format the completed block."

Tools | Options> Text Editor> C #> Formatting

+1
source

This seems to be a known issue reflected in these two error reports: http://youtrack.jetbrains.net/issue/RSRP-193396 and http://youtrack.jetbrains.net/issue/RSRP-178877 Please vote for them . I canโ€™t guarantee any fix schedule right now, but I hope we can fix it sooner rather than later.

+1
source

All Articles