@@ -12,17 +12,15 @@ func (ls *INOLanguageServer) createClangdFormatterConfig(logger jsonrpc.Function
1212 // https://github.com/llvm/llvm-project/blob/64d06ed9c9e0389cd27545d2f6e20455a91d89b1/clang-tools-extra/clangd/ClangdLSPServer.cpp#L856-L868
1313 // https://github.com/llvm/llvm-project/blob/64d06ed9c9e0389cd27545d2f6e20455a91d89b1/clang-tools-extra/clangd/ClangdServer.cpp#L402-L404
1414
15- config := `# See : https://releases.llvm.org/11.0.1/tools/clang/docs/ClangFormatStyleOptions.html
15+ config := `# Source : https://github.com/arduino/tooling-project-assets/tree/main/other/clang-format-configuration
1616---
17- Language: Cpp
18- # LLVM is the default style setting, used when a configuration option is not set here
19- BasedOnStyle: LLVM
2017AccessModifierOffset: -2
2118AlignAfterOpenBracket: Align
22- AlignConsecutiveAssignments: false
23- AlignConsecutiveBitFields: false
24- AlignConsecutiveDeclarations: false
25- AlignConsecutiveMacros: false
19+ AlignArrayOfStructures: None
20+ AlignConsecutiveAssignments: None
21+ AlignConsecutiveBitFields: None
22+ AlignConsecutiveDeclarations: None
23+ AlignConsecutiveMacros: None
2624AlignEscapedNewlines: DontAlign
2725AlignOperands: Align
2826AlignTrailingComments: true
@@ -33,24 +31,27 @@ AllowShortBlocksOnASingleLine: Always
3331AllowShortCaseLabelsOnASingleLine: true
3432AllowShortEnumsOnASingleLine: true
3533AllowShortFunctionsOnASingleLine: Empty
36- AllowShortIfStatementsOnASingleLine: Always
34+ AllowShortIfStatementsOnASingleLine: AllIfsAndElse
3735AllowShortLambdasOnASingleLine: Empty
3836AllowShortLoopsOnASingleLine: true
3937AlwaysBreakAfterDefinitionReturnType: None
4038AlwaysBreakAfterReturnType: None
4139AlwaysBreakBeforeMultilineStrings: false
4240AlwaysBreakTemplateDeclarations: No
41+ AttributeMacros:
42+ - __capability
43+ BasedOnStyle: LLVM
4344BinPackArguments: true
4445BinPackParameters: true
45- # Only used when "BreakBeforeBraces" set to "Custom"
46+ BitFieldColonSpacing: Both
4647BraceWrapping:
4748 AfterCaseLabel: false
4849 AfterClass: false
4950 AfterControlStatement: Never
5051 AfterEnum: false
5152 AfterFunction: false
5253 AfterNamespace: false
53- # AfterObjCDeclaration:
54+ AfterObjCDeclaration: false
5455 AfterStruct: false
5556 AfterUnion: false
5657 AfterExternBlock: false
@@ -59,104 +60,148 @@ BraceWrapping:
5960 BeforeLambdaBody: false
6061 BeforeWhile: false
6162 IndentBraces: false
62- SplitEmptyFunction: false
63- SplitEmptyRecord: false
64- SplitEmptyNamespace: false
65- # Java-specific
66- #BreakAfterJavaFieldAnnotations:
63+ SplitEmptyFunction: true
64+ SplitEmptyRecord: true
65+ SplitEmptyNamespace: true
66+ BreakAfterJavaFieldAnnotations: false
6767BreakBeforeBinaryOperators: NonAssignment
6868BreakBeforeBraces: Attach
69+ BreakBeforeConceptDeclarations: false
70+ BreakBeforeInheritanceComma: false
6971BreakBeforeTernaryOperators: true
7072BreakConstructorInitializers: BeforeColon
73+ BreakConstructorInitializersBeforeComma: false
7174BreakInheritanceList: BeforeColon
7275BreakStringLiterals: false
7376ColumnLimit: 0
74- # "" matches none
75- CommentPragmas: ""
77+ CommentPragmas: ''
7678CompactNamespaces: false
77- ConstructorInitializerAllOnOneLineOrOnePerLine: true
79+ ConstructorInitializerAllOnOneLineOrOnePerLine: false
7880ConstructorInitializerIndentWidth: 2
7981ContinuationIndentWidth: 2
8082Cpp11BracedListStyle: false
8183DeriveLineEnding: true
8284DerivePointerAlignment: true
8385DisableFormat: false
84- # Docs say "Do not use this in config files". The default (LLVM 11.0.1) is "false".
85- #ExperimentalAutoDetectBinPacking:
86+ EmptyLineAfterAccessModifier: Leave
87+ EmptyLineBeforeAccessModifier: Leave
88+ ExperimentalAutoDetectBinPacking: false
8689FixNamespaceComments: false
87- ForEachMacros: []
90+ ForEachMacros:
91+ - foreach
92+ - Q_FOREACH
93+ - BOOST_FOREACH
94+ IfMacros:
95+ - KJ_IF_MAYBE
8896IncludeBlocks: Preserve
89- IncludeCategories: []
90- # "" matches none
91- IncludeIsMainRegex: ""
92- IncludeIsMainSourceRegex: ""
97+ IncludeCategories:
98+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
99+ Priority: 2
100+ SortPriority: 0
101+ CaseSensitive: false
102+ - Regex: '^(<|"(gtest|gmock|isl|json)/)'
103+ Priority: 3
104+ SortPriority: 0
105+ CaseSensitive: false
106+ - Regex: '.*'
107+ Priority: 1
108+ SortPriority: 0
109+ CaseSensitive: false
110+ IncludeIsMainRegex: ''
111+ IncludeIsMainSourceRegex: ''
112+ IndentAccessModifiers: false
93113IndentCaseBlocks: true
94114IndentCaseLabels: true
95115IndentExternBlock: Indent
96116IndentGotoLabels: false
97117IndentPPDirectives: None
118+ IndentRequires: true
98119IndentWidth: 2
99120IndentWrappedFunctionNames: false
100121InsertTrailingCommas: None
101- # Java-specific
102- #JavaImportGroups:
103- # JavaScript-specific
104- #JavaScriptQuotes:
105- #JavaScriptWrapImports
122+ JavaScriptQuotes: Leave
123+ JavaScriptWrapImports: true
106124KeepEmptyLinesAtTheStartOfBlocks: true
107- MacroBlockBegin: ""
108- MacroBlockEnd: ""
109- # Set to a large number to effectively disable
125+ LambdaBodyIndentation: Signature
126+ Language: Cpp
127+ MacroBlockBegin: ''
128+ MacroBlockEnd: ''
110129MaxEmptyLinesToKeep: 100000
111130NamespaceIndentation: None
112- NamespaceMacros: []
113- # Objective C-specific
114- #ObjCBinPackProtocolList:
115- #ObjCBlockIndentWidth:
116- #ObjCBreakBeforeNestedBlockParam:
117- #ObjCSpaceAfterProperty:
118- #ObjCSpaceBeforeProtocolList
131+ ObjCBinPackProtocolList: Auto
132+ ObjCBlockIndentWidth: 2
133+ ObjCBreakBeforeNestedBlockParam: true
134+ ObjCSpaceAfterProperty: false
135+ ObjCSpaceBeforeProtocolList: true
136+ PPIndentWidth: -1
137+ PackConstructorInitializers: BinPack
119138PenaltyBreakAssignment: 1
120139PenaltyBreakBeforeFirstCallParameter: 1
121140PenaltyBreakComment: 1
122141PenaltyBreakFirstLessLess: 1
142+ PenaltyBreakOpenParenthesis: 1
123143PenaltyBreakString: 1
124144PenaltyBreakTemplateDeclaration: 1
125145PenaltyExcessCharacter: 1
146+ PenaltyIndentedWhitespace: 1
126147PenaltyReturnTypeOnItsOwnLine: 1
127- # Used as a fallback if alignment style can't be detected from code (DerivePointerAlignment: true)
128148PointerAlignment: Right
129- RawStringFormats: []
149+ QualifierAlignment: Leave
150+ ReferenceAlignment: Pointer
130151ReflowComments: false
131- SortIncludes: false
152+ RemoveBracesLLVM: false
153+ SeparateDefinitionBlocks: Leave
154+ ShortNamespaceLines: 0
155+ SortIncludes: Never
156+ SortJavaStaticImport: Before
132157SortUsingDeclarations: false
133158SpaceAfterCStyleCast: false
134159SpaceAfterLogicalNot: false
135160SpaceAfterTemplateKeyword: false
161+ SpaceAroundPointerQualifiers: Default
136162SpaceBeforeAssignmentOperators: true
163+ SpaceBeforeCaseColon: false
137164SpaceBeforeCpp11BracedList: false
138165SpaceBeforeCtorInitializerColon: true
139166SpaceBeforeInheritanceColon: true
140167SpaceBeforeParens: ControlStatements
168+ SpaceBeforeParensOptions:
169+ AfterControlStatements: true
170+ AfterForeachMacros: true
171+ AfterFunctionDefinitionName: false
172+ AfterFunctionDeclarationName: false
173+ AfterIfMacros: true
174+ AfterOverloadedOperator: false
175+ BeforeNonEmptyParentheses: false
141176SpaceBeforeRangeBasedForLoopColon: true
142177SpaceBeforeSquareBrackets: false
143178SpaceInEmptyBlock: false
144179SpaceInEmptyParentheses: false
145180SpacesBeforeTrailingComments: 2
146- SpacesInAngles: false
181+ SpacesInAngles: Leave
147182SpacesInCStyleCastParentheses: false
148183SpacesInConditionalStatement: false
149184SpacesInContainerLiterals: false
185+ SpacesInLineCommentPrefix:
186+ Minimum: 0
187+ Maximum: -1
150188SpacesInParentheses: false
151189SpacesInSquareBrackets: false
152190Standard: Auto
153- StatementMacros: []
191+ StatementAttributeLikeMacros:
192+ - Q_EMIT
193+ StatementMacros:
194+ - Q_UNUSED
195+ - QT_REQUIRE_VERSION
154196TabWidth: 2
155- TypenameMacros: []
156- # Default to LF if line endings can't be detected from the content (DeriveLineEnding).
157197UseCRLF: false
158198UseTab: Never
159- WhitespaceSensitiveMacros: []
199+ WhitespaceSensitiveMacros:
200+ - STRINGIZE
201+ - PP_STRINGIZE
202+ - BOOST_PP_STRINGIZE
203+ - NS_SWIFT_NAME
204+ - CF_SWIFT_NAME
160205`
161206 try := func (conf * paths.Path ) bool {
162207 if c , err := conf .ReadFile (); err != nil {
0 commit comments