How to Prevent Removal of partial modifier on type?

I'd like to prevent the removal of the 'partial' modifier during Full Code Cleanup without turning off the removal of the rest of the redundancies ReSharper finds. Is there a way to do this? Can it be done in .editorconfig? Can it be done at a project level?

1
6 comments
Avatar
Angelina Elycheva

Hello Ray!

 

The only way is disabling corresponding inspections. This can be done using ReSharper | Options | Code Inspection | Inspection Severity.

There're also editorconfig properties for these inspections:

  • resharper_partial_method_with_single_part_highlighting
  • resharper_partial_type_with_single_part_highlighting

Thank you.

0

I tried both of the editorconfig properties mentioned. While they did stop the highlighting/squiggly underlining, they did not prevent removal of the partial keyword when doing a clean-up (Ctrl-Alt-F).

Is there a way to accomplish this?

1
Avatar
Angelina Elycheva

Hello Ray,

 

Thank you for the reply.

Could you please try installing the latest ReSharper 2019.2 EAP build https://www.jetbrains.com/resharper/eap/ and check cleanup code issue is still reproduced.

Thank you.

0

I added the following to my .editorconfig:

resharper_partial_method_with_single_part_highlighting = do_not_show
resharper_partial_type_with_single_part_highlighting = do_not_show

The latest EAP release did *not* remove the partial keyword when doing a code cleanup.

I then reverted to 2019.1.3 and the partial keyword was removed when doing a code cleanup.

It looks like the EAP functions the way I was hoping for. Is this the way it should work?

0
Avatar
Angelina Elycheva

Hello Ray,

 

Yes, actually the was a bug, that was fixed in ReSharper 2019.2.

Thank you

0

Well it clearly wasn't fixed because I'm still getting that issue in 2019.3.

This isn't a StyleCop/inspection issue, this is a cleanup issue. I'm not even getting a warning for it and yet it still gets removed.

Where is the option to stop this happening?

0

Please sign in to leave a comment.