c# - Disable Resharper auto-formatting around certain blocks of code -
in c# development team, want share auto-formatting rules respect our coding standards have unified code formatting. i'm testing resharper , it's great have 1 rule in our standards can't seem around.
we use htmltextwriter render html have rule indent calls reflect how markup outputted.
for example :
protected override void renderbody(htmltextwriter writer) { writer.addattribute("class", "mystyle"); writer.renderbegintag("div"); writer.addattribute("class", "mystyle2"); writer.renderbegintag("div"); writer.write("hello world"); writer.renderendtag(); writer.renderendtag(); } for now, when reformat code using resharper (or vs), identation removed.
is there way add custom rule prevent/disable reformatting around .renderbegintag function calls? or there tool (other resharper or in addition resharper) that?
there's no way tell r# not clean part of code , imo don't want pollute code r#-specific markups. workaround indent function calls in brackets so:
private void renderbody(htmltextwriter writer) { writer.addattribute("class", "mystyle"); writer.renderbegintag("div"); { writer.addattribute("class", "mystyle2"); writer.renderbegintag("div"); { writer.write("hello world"); } writer.renderendtag(); } writer.renderendtag(); } r# won't reformat these blocks.
Comments
Post a Comment