Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper 5: How do I set the default formatting style for inline code blocks?

I've got a problem with the formatting of inline code blocks within the VS2010 text editor and wonder if anyone else has had similar problems and found the 'magic' setting I'm looking for.

I'm working my way through tutorials in an MVC book. Whenever I add some inline code blocks to a view I want them formatted like so:

<% foreach (var link in Model) { %>
   <a href="<%=Url.RouteUrl(link.RouteValues)%>">
      <%=link.Text%>
   </a>
<% } %>

What I'm actually getting is this (auto-formatted by the IDE when I finish writing the code):

<% foreach (var link in Model) { 
     %>
   <a href="<%=Url.RouteUrl(link.RouteValues)%>">
       <%=link.Text%>
   </a>
<% }
     %>

It's pretty irritating. Any ideas on how I can instruct the IDE to leave my <% %> tags alone? I've been fiddling with options under "Tools -> Options -> Text Editor" for ages but alas am getting nowhere...

Edit: I've just noticed that this is down to Resharper 5 (when I disable it the problem disappears), however I still don't know how to stop it. Any ideas?

like image 751
Matt B Avatar asked Apr 21 '10 12:04

Matt B


1 Answers

What i think your going to need to do is write your own rule within Visual studio for its HTML redering based on a custom tag. not the best solution but the only one i can think that might work.

like image 122
TheAlbear Avatar answered Oct 05 '22 23:10

TheAlbear