Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to keep ReSharper from formatting a region of code

I use ReSharper's code cleanup all the time, but sometimes I have code formatted in a way that makes it easier to read than ReSharper's formatter makes it. Is there a way to mark part of your file with comments or something to make it skip formatting that portion.

(I'm not talking about inspections, I know how to have ReSharper ignore regions for inspections)

like image 939
JeremyWeir Avatar asked Jan 19 '10 00:01

JeremyWeir


People also ask

How do I set rules in ReSharper?

Press Ctrl+Alt+Enter or choose ReSharper | Edit | Reformat Code from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.

How do I run ReSharper cleanup?

Select ReSharper | Options from the main menu or press Alt+R O . Go to the cleanup profiles settings page: Code Editing | Code Cleanup | Profiles. Select which Code Cleanup profile should be applied on save and click Set as default (the default profile is also used for silent cleanup).

How do I save and format code in Visual Studio?

In Visual Studio Code, press Control + Shift + P or Command + Shift + P (Mac) to open the command palette and type save and then select the Save without Formatting option.

How do I clean up Visual Studio code?

Right-click on the project or solution name in Solution Explorer, select Analyze and Code Cleanup, and then select Run Code Cleanup.


1 Answers

I had a discussion with Resharper support about this, their answer:

Thank you very much for this information! We will discuss if we can support such formatting style in one of the future versions.

like image 114
JeremyWeir Avatar answered Nov 15 '22 20:11

JeremyWeir