Flag a region to not be affected by the auto formatting rules
-
25-06-2021 - |
Question
I'm looking for a way to keep a region of my to code have a certain number of tab indents. The tabs are representing a relation to the field above it.
I.e.
public string Foo1
pubic string F1Bar1
public string Foo2
public string Foo3
public string F3Bar1
public string F3Bar2
public string F3B2Foobar1
public string Foo4
Running an auto format would of course align all these string, Is there a way to flag this part of code to be neglected by the auto formatter. keeping the indents while the rest of the code does get formatted?
(Resharper is Available for me)
Solution
No way to do it in ReSharper 7.0 or earlier. But you can vote for this feature here http://youtrack.jetbrains.com/issue/RSRP-9997 .
OTHER TIPS
You could add a newline after public
and indent before string
, i.e.:
public
string F1Bar1;
This format would not be changed, at least on my installation/settings (R# 5.1.3, VS 2010).
Unfortunatly this helps for second level only. It's not possible for third or more levels.