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.
Please sign in to leave a comment.
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!"
On 16.08.2010 11:05, Andrew Serebryansky wrote:
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 ...
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!"
>> Currently you can achieve this behavior by adding the file to the
>> generated files list under ReSharper | Options | Code Inspection |
>> Generated Code. Thank you!
>>
On 17.08.2010 11:18, Andrew Serebryansky wrote:
How about introducing something like a
#supress_clean
directive, so that individual code-blocks could be excluded from the
cleanup?
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!"
>> This is a solution-specific setting which is stored in
>>
Hello,
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!”
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?
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.
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!"
>>> 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?
>>