2017-10-22 8 views
0

clang 형식을 사용하고 싶지만 항상 returnType 다음에 새 행으로 시작합니다. 나는 설명서를 읽고Clang 형식 "AlwaysBreakAfterReturnType : None"이 작동하지 않습니다.

"AlwaysBreakAfterReturnType : 없음"시도

을하지만,이 효과가 없습니다 솔기. 우분투 17.10에서 QT 작성자의 clang-format 6.0을 사용하고 있습니다.

은 다음과 같습니다

int 
    main() { 
    ... 
} 

예상 :

int main() { 
    ... 
} 

버전 : 그 소리 포맷 6.0, 연타 형식의 설정 파일 :

BasedOnStyle: Mozilla 
AccessModifierOffset: -4 
AlignAfterOpenBracket: Align 
AlignConsecutiveAssignments : true 
AlignEscapedNewlines: Right 
AlignOperands: true 
AlignTrailingComments: true 
AllowAllParametersOfDeclarationOnNextLine: false 
AllowShortBlocksOnASingleLine: false 
AllowShortCaseLabelsOnASingleLine: false 
AllowShortFunctionsOnASingleLine: InlineOnly 
AllowShortIfStatementsOnASingleLine: false 
AllowShortLoopsOnASingleLine: false 
AlwaysBreakAfterReturnType: None 
AlwaysBreakBeforeMultilineStrings: false 
AlwaysBreakTemplateDeclarations: true 
BinPackArguments: false 
BinPackParameters: false 
BraceWrapping: 
    AfterClass: true 
    AfterControlStatement: false 
    AfterEnum: false 
    AfterFunction: false 
    AfterNamespace: false 
    AfterObjCDeclaration: false 
    AfterStruct: false 
    AfterUnion: false 
    AfterExternBlock: false 
    BeforeCatch: true 
    BeforeElse: true 
    SplitEmptyFunction: false 
    SplitEmptyRecord: false 
    SplitEmptyNamespace: false 
BreakBeforeBinaryOperators: All 
BreakBeforeBraces: Custom 
BreakBeforeInheritanceComma: true 
BreakBeforeTernaryOperators: true 
BreakConstructorInitializers: BeforeComma 
BreakStringLiterals : false 
ColumnLimit: 120 
CompactNamespaces: false 
ConstructorInitializerAllOnOneLineOrOnePerLine: true 
ConstructorInitializerIndentWidth: 4 
ContinuationIndentWidth: 4 
Cpp11BracedListStyle: false 
DerivePointerAlignment: true 
DisableFormat: false 
ExperimentalAutoDetectBinPacking: true 
FixNamespaceComments: true 
IndentCaseLabels: false 
IndentPPDirectives: AfterHash 
IndentWidth: 4 
IndentWrappedFunctionNames: true 
KeepEmptyLinesAtTheStartOfBlocks: false 
Language: Cpp 
MaxEmptyLinesToKeep: 1 
NamespaceIndentation: None 
PenaltyBreakBeforeFirstCallParameter: 19 
PenaltyBreakComment: 300 
PenaltyBreakFirstLessLess: 120 
PenaltyBreakString: 1000 
PenaltyExcessCharacter: 1000000 
PenaltyReturnTypeOnItsOwnLine: 60 
PointerAlignment: Left 
ReflowComments: true 
SortIncludes: true 
SortUsingDeclarations: true 
SpaceAfterCStyleCast: true 
SpaceAfterTemplateKeyword : false 
SpaceBeforeAssignmentOperators: true 
SpaceBeforeParens: ControlStatements 
SpaceInEmptyParentheses: false 
SpacesBeforeTrailingComments: 3 
SpacesInAngles: false 
SpacesInCStyleCastParentheses: true 
SpacesInContainerLiterals: true 
SpacesInParentheses: true 
SpacesInSquareBrackets: false 
Standard: Cpp11 
TabWidth: 4 
UseTab: Never 

어떤 아이디어?

+0

최소한의 예를 재현 할 수 있습니까 (C는 최소이지만 clang 형식의 구성은 아닙니다)? –

+0

최소 형식 : BasedOnStyle : Mozilla AlwaysBreakAfterReturnType : 없음 –

답변

0

난 당신이 주석으로 제공하는 최소한의 예에 문제를 재현 할 수 없습니다

$ cat .clang-format 
BasedOnStyle: Mozilla 
AlwaysBreakAfterReturnType: None 
$ cat main.c 
int main() { 
     return 0; 
} 
$ clang-format main.c 
int 
main() 
{ 
    return 0; 
} 
$ clang-format --version 
clang-format version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) 

는 사실, 당신은 또한 IndentWrappedFunctionNames 설정, 그 동작이 정확하게 당신이 얻을 하나입니다. 이 동작을 원하지 않으면 IndentWrappedFunctionNames을 설정하지 마십시오.