14

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.

1

2 Answers 2

21

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

Sign up to request clarification or add additional context in comments.

Comments

-1

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

1 Comment

I assume that OP is asking about some specific code block which should keep different formatting to the rest of the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.