开发者

Is there a way to keep ReSharper from formatting a region of code

开发者 https://www.devze.com 2022-12-16 16:08 出处:网络
I use ReSharper\'s code cleanup all the time, but sometimes I have c开发者_Python百科ode formatted in a way that makes it easier to read than ReSharper\'s formatter makes it. Is there a way to mark pa

I use ReSharper's code cleanup all the time, but sometimes I have c开发者_Python百科ode formatted in a way that makes it easier to read than ReSharper's formatter makes it. Is there a way to mark part of your file with comments or something to make it skip formatting that portion.

(I'm not talking about inspections, I know how to have ReSharper ignore regions for inspections)


I had a discussion with Resharper support about this, their answer:

Thank you very much for this information! We will discuss if we can support such formatting style in one of the future versions.


Probably not, but you can try writing your own Resharper plugin


As of writing this, you can actually do it the other way around. I.e., format only a selected area of code. Just select the desired block, hit Alt+Enter and type Format Selection. Meanwhile Silent Code Cleanup still cleans up the whole file. I agree, that a comment-styled exclusion would be very nice.

Is there a way to keep ReSharper from formatting a region of code


Yes, now it is, see this answer and this feature request:

// @formatter:off
... Code you don't want formatted here ...
// @formatter:on
0

精彩评论

暂无评论...
验证码 换一张
取 消