Disable code cleanup on aspx & ascx files?

Is it possible to Disable code cleanup on aspx & ascx files?

Or customize the formatting style for aspx & ascx files?

9 comments

I realize now that the content within the <% %> tags is considered C# code and is getting formatted with those rules. Is it possible to add some kind of pragma that disables formatting for a specific file?

0

Is it possible to disable resharper entirely from  analyzing aspx/ascx/* files? With resharper 4.5 visual studio sometimes (well, pretty often actually) just dies on me when trying to open large web projects. It seems like more people has the same problem too (http://jetbrains.net/devnet/message/5238207, http://jetbrains.net/devnet/thread/282832?tstart=0).

A quick solution would be if I just could tell resharper to not inspect files with certain file endings.

0

Resharper guys,

I think this issue needs serious attention. I think code cleanup has become almost useless in ASP.Net MVC projects given that <% %> block code is common and these blocks are now made entirely ugly by the c# reformating rules being applied to them. So much so that unless there is some option to apply different formatting rules for code inside of aspx pages OR formatting can be disabled for these pages, then I am going to have to advise my team to stop using the feature for the MVC web app project. This is a BIG shame as its a feature I like quite a lot.

And yes I know its possible to pick the files you want to clean, but this is generally impractical. Its only really practical to reformat on a project or solution wide basis.

Please, please consider this for the near future (or now!).

Thanks

Christian

0

I agree.  There is nothing more frustrating than adding a <% } %> to finish out Html.BeginForm() and have all markup inside the form go crazy because of formatting :-(

0

Hello Nicholas,

Could you please attach a small sample solution which would show this behavior?
Thank you!

Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I agree.  There is nothing more frustrating than adding a <% } %> to
finish out Html.BeginForm() and have all markup inside the form go
crazy because of formatting :(

---
Original message URL:
http://devnet.jetbrains.net/message/5270431#5270431



0

All .aspx pages have code cleanup, why do you need an example?

They are saying code cleanup makes mixing C# in ASPX/ASCX ugly, and they are absolutely correct.

Please, +1, let us disable automatic code cleanup / formatting in ASPX/ASCX files.

0

Hello frank,

Could you please attach any particular example when code cleanup makes mixing
C# and aspx/ascx ugly? Thank you!

Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

cleanup



0

Sorry not to be more specific.  I think code mixed in markup is ugly in general, but Resharper takes away flexibility in how I format it, unless I want to constantly change it.

  For instance, if I want to generate a bunch of similar tabs in a loop...  Any time I type in a curly brace, the whole block of code gets reformater to resharpers preference.  I would like to keep the loop code tight, so it doesn't take too many lines and is readable:

    <% for (int i = 0; i < count; i++) { %>
        <div id="div<%= i %>"></div>
    <% } %>

  Resharper will frequently reformat the code as I type, and give me something like this:

    <% for (int i = 0; i < count; i++)
       {%>
        <div id="div<%=i%>"></div>
    <%
       }%>

  I really don't want a whole line for the curly brace, but thats what I get.  It is true that my code formatting is setup to have curly braces on the next line, that is my preference for CS files, but in ASPX it is ghastly to read.

0

Hello frank,

Thank you very much for the example! Here's the issue you can monitor (or
vote): http://youtrack.jetbrains.net/issue/RSRP-191190. We will discuss how
this problem can be addressed and when.

Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Sorry not to be more specific.  I think code mixed in markup is ugly
in general, but Resharper takes away flexibility in how I format it,
unless I want to constantly change it.

For instance, if I want to generate a bunch of similar tabs in a
loop...  Any time I type in a curly brace, the whole block of code
gets reformater to resharpers preference.  I would like to keep the
loop code tight, so it doesn't take too many lines and is readable:

<% for (int i = 0; i < count; i++) { %>
<div id="div<%= i %>"></div>
<% } %>
Resharper will frequently reformat the code as I type, and give me
something like this:

<% for (int i = 0; i < count; i++)
{%>
<div id="div<%=i%>"></div>
<%
}%>
I really don't want a whole line for the curly brace, but thats what
I get.  It is true that my code formatting is setup to have curly
braces on the next line, that is my preference for CS files, but in
ASPX it is ghastly to read.

---
Original message URL:
http://devnet.jetbrains.net/message/5272503#5272503



0

Please sign in to leave a comment.