views:

357

answers:

1

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?

+1  A: 

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.

TheAlbear