Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
clang格式将函数参数/参数缩进,始终使用4个空格_C_Clang Format - Fatal编程技术网

clang格式将函数参数/参数缩进,始终使用4个空格

clang格式将函数参数/参数缩进,始终使用4个空格,c,clang-format,C,Clang Format,我面临着一些关于叮当声格式结果的问题。顺便说一下,我正在使用v3.8.0.246435 考虑以下代码示例: if(foo) { bar(); foobar( arg1, arg2, arg3, arg4, arg5, arg6); } 在上面的代码中,所有内容都缩进了3个空格。 现在,如果我在这段代码上运行clang format(请参阅我文章底部的clang format配置),我将得到以下输出: if(fo

我面临着一些关于叮当声格式结果的问题。顺便说一下,我正在使用v3.8.0.246435

考虑以下代码示例:

if(foo)
{
   bar();
   foobar(
      arg1,
      arg2,
      arg3,
      arg4,
      arg5,
      arg6);
}
在上面的代码中,所有内容都缩进了3个空格。 现在,如果我在这段代码上运行clang format(请参阅我文章底部的clang format配置),我将得到以下输出:

if(foo)
{
/*V 3 spaces here */
   bar();
   foobar(
       arg1,
       arg2,
       arg3,
       arg4,
       arg5,
       arg6);
   /*^ 4 spaces here */
}
我觉得这是一种非常奇怪的行为。我希望在整个代码中使用相同的缩进级别。似乎铿锵格式总是用4个空格缩进函数参数,不管
IndentWidth
有什么值。有没有办法克服这种行为?还是这是一只虫子

我的叮当声格式:

Language: Cpp
SpaceBeforeParens: Never
SpacesInParentheses: false
SpaceAfterCStyleCast: true
SpacesInSquareBrackets: false
AllowShortIfStatementsOnASingleLine: false
PointerAlignment: Right
AlignOperands: true
AlignConsecutiveAssignments: true
AlignAfterOpenBracket: false
UseTab: Never
IndentWidth: 3
TabWidth: 3
ColumnLimit: 100
MaxEmptyLinesToKeep: 4
KeepEmptyLinesAtTheStartOfBlocks: false
BreakBeforeBraces: Stroustrup
BinPackArguments: false
BinPackParameters: false
AllowShortFunctionsOnASingleLine: None
AlignEscapedNewlinesLeft: true

事实上,我找到了丢失的命令。你必须加上

ContinuationIndentWidth: 3
或任何您想要的数字,以便它以您想要的方式缩进连续的行。默认值为4