diff --git a/templates/cpp/.clang-format b/templates/cpp/.clang-format index c1928399..8536f783 100644 --- a/templates/cpp/.clang-format +++ b/templates/cpp/.clang-format @@ -2,46 +2,10 @@ Language: Cpp BasedOnStyle: Google -# Keep consistent with the repo-wide 100 char guidance (adjust per-project if needed). -ColumnLimit: 100 -IndentWidth: 4 - -AccessModifierOffset: -4 -AlignEscapedNewlines: Left -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortFunctionsOnASingleLine: All -AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: false -BinPackParameters: false -BraceWrapping: - AfterCaseLabel: true - AfterUnion: true - AfterExternBlock: false -BreakBeforeTernaryOperators: false -BreakConstructorInitializers: AfterColon -BreakInheritanceList: AfterColon -CommentPragmas: "suppress" -ConstructorInitializerAllOnOneLineOrOnePerLine: true -Cpp11BracedListStyle: false -FixNamespaceComments: false -IncludeBlocks: Regroup -IncludeCategories: - - Regex: '^.*(precomp|pch|stdafx)' - Priority: -1 - - Regex: '^".*"' - Priority: 1 - - Regex: '^<.*>' - Priority: 2 - - Regex: '.*' - Priority: 3 -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: "BEGIN_TEST_METHOD_PROPERTIES|BEGIN_MODULE|BEGIN_TEST_CLASS|BEGIN_TEST_METHOD" -MacroBlockEnd: "END_TEST_METHOD_PROPERTIES|END_MODULE|END_TEST_CLASS|END_TEST_METHOD" -NamespaceIndentation: None -PointerAlignment: Left -ReflowComments: false -SortIncludes: false -SpaceAfterTemplateKeyword: false -SpacesInAngles: false -SpacesInContainerLiterals: false +# --- intentional deviations from Google C++ defaults --- +ColumnLimit: 120 # Google: 80 +IndentWidth: 4 # Google: 2 +TabWidth: 4 # Google/LLVM: 8(UseTab: Never 时几乎无感,与缩进对齐) +AccessModifierOffset: -4 # Google: -1(配合 IndentWidth 4,使 public/private 与 class 同级) +BreakBeforeBraces: Allman # Google: Attach +AllowShortFunctionsOnASingleLine: Inline # 需要显示Inline diff --git a/templates/cpp/.clangd b/templates/cpp/.clangd index be8b66f2..3a06649b 100644 --- a/templates/cpp/.clangd +++ b/templates/cpp/.clangd @@ -22,4 +22,3 @@ CompileFlags: Add: - "-std=c17" Compiler: clang -