Как сделать так, чтобы формат clang не разрывался между типом и переменной? ⇐ C++
-
Гость
Как сделать так, чтобы формат clang не разрывался между типом и переменной?
My clang-format's result is as follows:
cmn::Atomic my_var; int main() { } However, I want my_var to be on the same line of std::mutex>, just like this:
cmn::Atomic my_var; int main() { } How to make clang-format work as I expect? My .clang-format file contents:
BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: DontAlign AlignArrayOfStructures: None AlignConsecutiveAssignments: true AlignConsecutiveBitFields: true AlignConsecutiveDeclarations: true AlignConsecutiveMacros: true AlignEscapedNewlines: Left AlignOperands: AlignAfterOperator AlignTrailingComments: true AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes BinPackArguments: true BinPackParameters: true BitFieldColonSpacing: Both BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom BreakBeforeConceptDeclarations: Always BreakBeforeTernaryOperators: true BreakTemplateDeclarations: Yes BraceWrapping: AfterCaseLabel: false AfterClass: false AfterControlStatement: false AfterEnum: false AfterFunction: false AfterNamespace: false AfterStruct: false AfterUnion: false AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false BreakConstructorInitializersBeforeComma: true BreakConstructorInitializers: AfterColon BreakInheritanceList: BeforeComma BreakStringLiterals: false ColumnLimit: 80 CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: Always FixNamespaceComments: true ForEachMacros: ['LOOP', 'LOOP_N', 'FOR', 'TEST_CASE'] TypenameMacros: ['LIST_ENTRY'] IncludeBlocks: Preserve IndentAccessModifiers: false IndentCaseLabels: false IndentExternBlock: NoIndent IndentGotoLabels: true IndentPPDirectives: BeforeHash IndentRequires: false IndentWidth: 4 IndentWrappedFunctionNames: true InsertNewlineAtEOF: true InsertTrailingCommas: None KeepEmptyLinesAtTheStartOfBlocks: false LineEnding: LF MacroBlockBegin: "^BEGIN_OF_EXAMPLE1|BEGIN_OF_EXAMPLE2$" MacroBlockEnd: "^END_OF_EXAMPLE$" MaxEmptyLinesToKeep: 1 NamespaceIndentation: None PointerAlignment: Left PackConstructorInitializers: BinPack ReflowComments: false SeparateDefinitionBlocks: Always SortIncludes: true SortUsingDeclarations: false SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: 1 SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Latest StatementMacros: ['UNUSED_ARG'] TabWidth: 4 UseTab: Never --- Language: Cpp --- Language: Proto
My clang-format's result is as follows:
cmn::Atomic my_var; int main() { } However, I want my_var to be on the same line of std::mutex>, just like this:
cmn::Atomic my_var; int main() { } How to make clang-format work as I expect? My .clang-format file contents:
BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: DontAlign AlignArrayOfStructures: None AlignConsecutiveAssignments: true AlignConsecutiveBitFields: true AlignConsecutiveDeclarations: true AlignConsecutiveMacros: true AlignEscapedNewlines: Left AlignOperands: AlignAfterOperator AlignTrailingComments: true AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes BinPackArguments: true BinPackParameters: true BitFieldColonSpacing: Both BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom BreakBeforeConceptDeclarations: Always BreakBeforeTernaryOperators: true BreakTemplateDeclarations: Yes BraceWrapping: AfterCaseLabel: false AfterClass: false AfterControlStatement: false AfterEnum: false AfterFunction: false AfterNamespace: false AfterStruct: false AfterUnion: false AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false BreakConstructorInitializersBeforeComma: true BreakConstructorInitializers: AfterColon BreakInheritanceList: BeforeComma BreakStringLiterals: false ColumnLimit: 80 CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: Always FixNamespaceComments: true ForEachMacros: ['LOOP', 'LOOP_N', 'FOR', 'TEST_CASE'] TypenameMacros: ['LIST_ENTRY'] IncludeBlocks: Preserve IndentAccessModifiers: false IndentCaseLabels: false IndentExternBlock: NoIndent IndentGotoLabels: true IndentPPDirectives: BeforeHash IndentRequires: false IndentWidth: 4 IndentWrappedFunctionNames: true InsertNewlineAtEOF: true InsertTrailingCommas: None KeepEmptyLinesAtTheStartOfBlocks: false LineEnding: LF MacroBlockBegin: "^BEGIN_OF_EXAMPLE1|BEGIN_OF_EXAMPLE2$" MacroBlockEnd: "^END_OF_EXAMPLE$" MaxEmptyLinesToKeep: 1 NamespaceIndentation: None PointerAlignment: Left PackConstructorInitializers: BinPack ReflowComments: false SeparateDefinitionBlocks: Always SortIncludes: true SortUsingDeclarations: false SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: 1 SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Latest StatementMacros: ['UNUSED_ARG'] TabWidth: 4 UseTab: Never --- Language: Cpp --- Language: Proto
Мобильная версия