tags:

views:

154

answers:

2

I find myself constantly pressing ctrl-z to undo the automatic formatting that happens in templates. For example Resharper would like to format a foreach loop like this:

<%
  foreach (var product in Model.Items)
  { %>
      <li><%= product.Name %></li>
<% } %>

This is fine in c# code files but it just seems messy in templates. I would prefer to format it like this

<% foreach (var product in Model.Items) { %>
    <li><%= product.Name %></li>
<% } %>
+1  A: 

Resharper does not allow you to create custom formatting. You can only change the predefined formatting under options. I poked around and did not see <% %> formatting options. Sorry :(

Jason Heine
+3  A: 

Open Visual Studio Goto Resharper > Options... > Langauges > C# > Formatting Style > Braces Layout > Other

Change to "At end of line (no space)"

Note this will affect your C# as well.

It is a bit annoying that you cant specify a different code sytle for you aspx pages since its often you do want something differnt.

Saint Gerbil