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

2

12

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.

Skat answered 30/10, 2020 at 14:2 Comment(1)
See jetbrains.com/help/resharper/…Simulcast
I
18

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

Incommensurate answered 30/10, 2020 at 14:9 Comment(0)
S
-1

You can add an .editorconfig to your project to customize the formatting behavior.
See https://www.jetbrains.com/help/rider/Using_EditorConfig.html

Saree answered 30/10, 2020 at 14:5 Comment(1)
I assume that OP is asking about some specific code block which should keep different formatting to the rest of the code.Incommensurate

© 2022 - 2024 — McMap. All rights reserved.