Reputation: 4138
I'm trying to format a C file with clang-format. I want indentations to be two space characters, which mostly works except for in global variable struct initialization. For this, it continues to produce lines which are indented with four spaces.
Here is my .clang-format file
BasedOnStyle: LLVM
ColumnLimit: '80'
IndentWidth: '2'
clang-format produces this surprising output
typedef struct {
int x;
} foo;
static foo bar{
1, // This line is being indented with 4 spaces!
};
And this is what I'd expect the file to look like:
typedef struct {
int x;
} foo;
static foo bar{
1, // This line is being indented with 2 spaces!
};
I've tried using a few different values for ConstructorInitializerIndentWidth
, but that field doesn't appear to affect this pattern.
Is there a setting that I could provide to get this behavior?
Upvotes: 2
Views: 1745
Reputation: 36
Try ContinuationIndentWidth: 2
. That worked for me, when I had that problem.
Upvotes: 2