我想要这个:
if (!enabled)
{
return;
}
Run Code Online (Sandbox Code Playgroud)
转向这个:
if (!enabled) { return; }
Run Code Online (Sandbox Code Playgroud)
(换句话说,我想在单行上使用简短的if语句但保留{}它们)
目前我正在使用以下配置:
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
BreakBeforeBraces: Allman
Run Code Online (Sandbox Code Playgroud)
但是,我得到的输出是:
if (!enabled)
{
return;
}
Run Code Online (Sandbox Code Playgroud)
是否可以使用clang格式完成上述格式化?
删除
BreakBeforeBraces:奥尔曼
似乎做你想要的(对我来说).我虽然使用SVN铿锵声.虽然你可能想要它有一个原因.
根据clang格式的文档,AllowShortBlocksOnASingleLine应该完全按照你想要的(不管支撑样式).这可能是clang格式的错误.
| 归档时间: |
|
| 查看次数: |
594 次 |
| 最近记录: |