clang-format
has tons of configuration options regarding whitespace and also some about code order (order of includes). Is it possible to reorder const-qualifiers so that they are placed to the right of the respective type?
Example: The declaration const int x = 0;
should be formatted to int const x = 0;
.
From version 14.0 onwards, clang-format offers the option
QualifierAlignment
which can take the following values:Leave
,Left
,Right
andCustom
.OP's request can thus be achieved with
Documentation can be found here
Edit: More information on values of
QualifierAlignment
When
Custom
is used as the value forQualifierAlignment
, the order from the clang-format optionQualifierOrder
is used. These two options have to then be used together, like so:Edit2: It seems the prefix 'QAS' of QAS_Right, QAS_Left etc is not needed.