Suppress Cleanup

Hi,

is there a way to prevent R# from doing a code cleanup to just one file?
In general I like the cleanup of R# very much, but in one particular
file I don't want the fields to be reordered in alphabetical order,
because the actual order of the fields is important.

8 comments
Comment actions Permalink

Hello Henning,

Currently you can achieve this behavior by adding the file to the generated
files list under ReSharper | Options | Code Inspection | Generated Code.
Thank you!

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

Hi,

is there a way to prevent R# from doing a code cleanup to just one
file? In general I like the cleanup of R# very much, but in one
particular file I don't want the fields to be reordered in
alphabetical order, because the actual order of the fields is
important.



0
Comment actions Permalink

On 16.08.2010 11:05, Andrew Serebryansky wrote:

Currently you can achieve this behavior by adding the file to the
generated files list under ReSharper | Options | Code Inspection |
Generated Code. Thank you!


Ah, ok - I see. But this would be only applicable to this one project,
since this is a special file. Currently I have my R#-Settings not per
project but instead globally ...

0
Comment actions Permalink

Hello Henning,

This is a solution-specific setting which is stored in .resharper
file under your solution folder. Thank you!

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

On 16.08.2010 11:05, Andrew Serebryansky wrote:

>> Currently you can achieve this behavior by adding the file to the
>> generated files list under ReSharper | Options | Code Inspection |
>> Generated Code. Thank you!
>>

Ah, ok - I see. But this would be only applicable to this one project,
since this is a special file. Currently I have my R#-Settings not per
project but instead globally ...



0
Comment actions Permalink

On 17.08.2010 11:18, Andrew Serebryansky wrote:

This is a solution-specific setting which is stored in
<solution_name>.<version>.resharper file under your solution folder.


How about introducing something like a

#supress_clean

directive, so that individual code-blocks could be excluded from the
cleanup?

0
Comment actions Permalink

Hello Henning,

Thank you for suggestion! Here's the corresponding feature request: http://youtrack.jetbrains.net/issue/RSRP-187963
and you're welcome to vote for it.

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

On 17.08.2010 11:18, Andrew Serebryansky wrote:

>> This is a solution-specific setting which is stored in
>> 

How about introducing something like a

#supress_clean

directive, so that individual code-blocks could be excluded from the
cleanup?



0
Comment actions Permalink

Hello,

How about introducing something like a

#supress_clean

directive, so that individual code-blocks could be excluded from the
cleanup?


Speaking about member reordering, there's an attribute you can apply on a
per-class basis, , which will prevent R# from applying
the member order rules. It is listed in the default member reordering template,
if I remember it correctly. Andrey, is this so?


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

On 17.08.2010 19:54, Serge Baltic wrote:

>> How about introducing something like a
>>
>> #supress_clean
>>
>> directive, so that individual code-blocks could be excluded from the
>> cleanup?


Speaking about member reordering, there's an attribute you can apply on
a per-class basis, , which will prevent R# from
applying the member order rules. It is listed in the default member
reordering template, if I remember it correctly. Andrey, is this so?


And how would I use this attribute? I mean - just adding
to my class doesn't do the trick, because I'll get
a compile error stating that the symbol could not be resolved - obviously!

Do I have to add a reference to Jetbrains.Annotations? I would very much
dislike that, because I see no point in adding such a dependency to the
project.

0
Comment actions Permalink

Hello Henning,

Here's what you can do:
1. Add basic NoReorder attribute implementation into your solution:

public class NoReorderAttribute : Attribute
{
}

2. Add a custom pattern element under ReSharper | Options | Languages | C#
| Type Member Layout, that matches any type with that attribute and doesn't
do anything:

   

This will apply an empty pattern to classes marked with your NoReorderAttribute
during member reordering. Thank you!

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

On 17.08.2010 19:54, Serge Baltic wrote:

>>> How about introducing something like a
>>>
>>> #supress_clean
>>>
>>> directive, so that individual code-blocks could be excluded from the
>>> cleanup?
>>>
>> Speaking about member reordering, there's an attribute you can apply
>> on a per-class basis, , which will prevent R#
>> from applying the member order rules. It is listed in the default
>> member reordering template, if I remember it correctly. Andrey, is
>> this so?
>>

And how would I use this attribute? I mean - just adding
to my class doesn't do the trick, because I'll
get a compile error stating that the symbol could not be resolved -
obviously!

Do I have to add a reference to Jetbrains.Annotations? I would very
much dislike that, because I see no point in adding such a dependency
to the project.



0

Please sign in to leave a comment.