Clang 格式结构初始化 - 缩进两个空格?
Clang-format struct initialization - indent with two spaces?
我正在尝试使用 clang 格式格式化 C 文件。我希望缩进是两个 space 字符,除了在全局变量结构初始化中外,它大部分都有效。为此,它继续生成缩进四个 spaces.
的行
这是我的 .clang 格式文件
BasedOnStyle: LLVM
ColumnLimit: '80'
IndentWidth: '2'
clang-format 产生了这个令人惊讶的输出
typedef struct {
int x;
} foo;
static foo bar{
1, // This line is being indented with 4 spaces!
};
这就是我希望文件的样子:
typedef struct {
int x;
} foo;
static foo bar{
1, // This line is being indented with 2 spaces!
};
我已尝试为 ConstructorInitializerIndentWidth
使用几个不同的值,但该字段似乎不会影响此模式。
是否有我可以提供的设置来实现此行为?
尝试ContinuationIndentWidth: 2
。当我遇到那个问题时,这对我有用。
我正在尝试使用 clang 格式格式化 C 文件。我希望缩进是两个 space 字符,除了在全局变量结构初始化中外,它大部分都有效。为此,它继续生成缩进四个 spaces.
的行这是我的 .clang 格式文件
BasedOnStyle: LLVM
ColumnLimit: '80'
IndentWidth: '2'
clang-format 产生了这个令人惊讶的输出
typedef struct {
int x;
} foo;
static foo bar{
1, // This line is being indented with 4 spaces!
};
这就是我希望文件的样子:
typedef struct {
int x;
} foo;
static foo bar{
1, // This line is being indented with 2 spaces!
};
我已尝试为 ConstructorInitializerIndentWidth
使用几个不同的值,但该字段似乎不会影响此模式。
是否有我可以提供的设置来实现此行为?
尝试ContinuationIndentWidth: 2
。当我遇到那个问题时,这对我有用。