Open
Description
Description
The UseTab
option is set to Always
, but clang-format is using spaces to align the <<
operator in continued lines. This behavior occurs even when all the Align*
options are set to false
. Also BreakBeforeBinaryOperators
has no influence on the alignment (or even breaking before/after) of the stream operator <<
.
The unwanted leading spaces then trigger other format checkers like EditorConfig (which is set to indent_style·=·tab
)
Steps to reproduce
- Create a minimal
.clang-format
file with the following configuration:
---
AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: false
BreakBeforeBinaryOperators: NonAssignment
ColumnLimit: 80
ContinuationIndentWidth: 4
IndentWidth: 4
TabWidth: 4
UseTab: Always
...
- Use clang-format to format the following code:
void someFunction() {
std::cout << someVariable << "Some random string for std::cout " << someOtherVariable << ", "
<< andAnotherOne << andOneMore << ", some final text.";
}
Expected behavior
The <<
operators in the continued lines should not be aligned and only be indented with tab characters, not with spaces:
void someFunction() {
std::cout << someVariable << "Some random string for std::cout "
<< someOtherVariable << ", " << andAnotherOne << andOneMore
<< ", some final text.";
}
Actual behavior
The <<
operators in the continued lines are indented with three tabs and with two additional spaces for alignment:
void someFunction() {
std::cout << someVariable << "Some random string for std::cout "
<< someOtherVariable << ", " << andAnotherOne << andOneMore
<< ", some final text.";
}
Environment
- clang-format version:
Debian clang-format version 14.0.6
- Operating system: Debian Testing x86_64