简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM