Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Rider How to disable format/reformat in a block of code?

Tags:

c#

rider

I've got some C# code that has specific format that I don't want re-formatted by Rider.

Is there some directive I can add to my code to tell Rider that this section shouldn't be reformatted?

Thanks.

like image 632
cdarrigo Avatar asked Jan 25 '26 16:01

cdarrigo


1 Answers

To disable auto formatting for some code block you can use formatter directive:

// @formatter:off

some custom formatted code that should be kept as is.
   
// @formatter:on 

Possibly you will need to enable it in settings: Settings -> Editor -> Code Style -> Formatter Control tab:

enter image description here

like image 108
Guru Stron Avatar answered Jan 28 '26 06:01

Guru Stron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!