Как удалить пробелы перед инициализацией параметров в формате clang? - PullRequest
0 голосов
/ 24 октября 2019

В файле формата clang код отображается в той же позиции, что и исходные параметры. Мне бы хотелось, чтобы в начальных параметрах не было пробела, но в остальной части кода должно быть 4 пробела (размер одной вкладки). Как мне достичь желаемого формата?

У меня есть это:

int main() {
    int i;
    int j; //parameters initialized
    if() {
        // stuff    //rest of the code
    }
}

Я хочу это:

int main() {
int i;
int j; //parameters initialized
    if() {
        // stuff    //rest of the code
    }
}

Мой файл в формате clang выглядит следующим образом:

# Abgeänderte .clang-format-Datei
# Anhaltspunkt ist https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# sowie: https://clangformat.com

#for visual studio 2017 you have to comment this one thing:
#BreakInheritanceList: AfterColon

#version for visual studio 2017:
#Language: Cpp
#BasedOnStyle: LLVM
AccessModifierOffset: 0
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands:   true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
#BreakInheritanceList: AfterColon
ColumnLimit:     300
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat:   false
SortIncludes: false
IndentCaseLabels: true
IndentWidth:     2
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
#PenaltyBreakBeforeFirstCallParameter: 19
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyExcessCharacter: 1000000
#PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments:  true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 4
SpacesInAngles:  true
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
SpacesInSquareBrackets: true
TabWidth:        4
UseTab:          Never
...