在一段代码中禁用 resharper 换行符?
Disable resharper line break in a section of code?
使用检查,我可以轻松禁用和恢复 resharper 重新格式化设置。比如像这样:
// ReSharper disable SuggestVarOrType_BuiltInTypes
int i = 1;
// ReSharper restore SuggestVarOrType_BuiltInTypes
所以..有没有什么方法可以对换行做同样的事情,这样我就可以在我的代码中的特殊地方有很长的行,而仍然有 resharper 打破其他人?
基本上,我想,我要求用密码代替上面的 "SuggestVarOrType_BuiltInTypes" :-)
尝试使用这些评论:
// @formatter:wrap_lines False
{the code block for which you would like to disable wrapping long lines}
// @formatter:wrap_lines restore
顺便说一句,您可能会使用这种方式自己找到大部分格式化程序注释:
select needed code block | hit the Alt+Enter shortcut | hit the "Right arrow" key on the "Format selection" item in the menu to open a submenu | hit "Configure"
-> 它将打开新的 window,它会显示所有影响代码块的格式化程序设置。
然后欢迎您更改所有您喜欢的设置并单击 Save as comments
按钮 -> 您将在代码块周围获得所需的一切作为注释。
使用检查,我可以轻松禁用和恢复 resharper 重新格式化设置。比如像这样:
// ReSharper disable SuggestVarOrType_BuiltInTypes
int i = 1;
// ReSharper restore SuggestVarOrType_BuiltInTypes
所以..有没有什么方法可以对换行做同样的事情,这样我就可以在我的代码中的特殊地方有很长的行,而仍然有 resharper 打破其他人?
基本上,我想,我要求用密码代替上面的 "SuggestVarOrType_BuiltInTypes" :-)
尝试使用这些评论:
// @formatter:wrap_lines False
{the code block for which you would like to disable wrapping long lines}
// @formatter:wrap_lines restore
顺便说一句,您可能会使用这种方式自己找到大部分格式化程序注释:
select needed code block | hit the Alt+Enter shortcut | hit the "Right arrow" key on the "Format selection" item in the menu to open a submenu | hit "Configure"
-> 它将打开新的 window,它会显示所有影响代码块的格式化程序设置。
然后欢迎您更改所有您喜欢的设置并单击 Save as comments
按钮 -> 您将在代码块周围获得所需的一切作为注释。