@@ -12,17 +12,15 @@ func (ls *INOLanguageServer) createClangdFormatterConfig(logger jsonrpc.Function
12
12
// https://github.com/llvm/llvm-project/blob/64d06ed9c9e0389cd27545d2f6e20455a91d89b1/clang-tools-extra/clangd/ClangdLSPServer.cpp#L856-L868
13
13
// https://github.com/llvm/llvm-project/blob/64d06ed9c9e0389cd27545d2f6e20455a91d89b1/clang-tools-extra/clangd/ClangdServer.cpp#L402-L404
14
14
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
16
16
---
17
- Language: Cpp
18
- # LLVM is the default style setting, used when a configuration option is not set here
19
- BasedOnStyle: LLVM
20
17
AccessModifierOffset: -2
21
18
AlignAfterOpenBracket: 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
26
24
AlignEscapedNewlines: DontAlign
27
25
AlignOperands: Align
28
26
AlignTrailingComments: true
@@ -33,24 +31,27 @@ AllowShortBlocksOnASingleLine: Always
33
31
AllowShortCaseLabelsOnASingleLine: true
34
32
AllowShortEnumsOnASingleLine: true
35
33
AllowShortFunctionsOnASingleLine: Empty
36
- AllowShortIfStatementsOnASingleLine: Always
34
+ AllowShortIfStatementsOnASingleLine: AllIfsAndElse
37
35
AllowShortLambdasOnASingleLine: Empty
38
36
AllowShortLoopsOnASingleLine: true
39
37
AlwaysBreakAfterDefinitionReturnType: None
40
38
AlwaysBreakAfterReturnType: None
41
39
AlwaysBreakBeforeMultilineStrings: false
42
40
AlwaysBreakTemplateDeclarations: No
41
+ AttributeMacros:
42
+ - __capability
43
+ BasedOnStyle: LLVM
43
44
BinPackArguments: true
44
45
BinPackParameters: true
45
- # Only used when "BreakBeforeBraces" set to "Custom"
46
+ BitFieldColonSpacing: Both
46
47
BraceWrapping:
47
48
AfterCaseLabel: false
48
49
AfterClass: false
49
50
AfterControlStatement: Never
50
51
AfterEnum: false
51
52
AfterFunction: false
52
53
AfterNamespace: false
53
- # AfterObjCDeclaration:
54
+ AfterObjCDeclaration: false
54
55
AfterStruct: false
55
56
AfterUnion: false
56
57
AfterExternBlock: false
@@ -59,104 +60,148 @@ BraceWrapping:
59
60
BeforeLambdaBody: false
60
61
BeforeWhile: false
61
62
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
67
67
BreakBeforeBinaryOperators: NonAssignment
68
68
BreakBeforeBraces: Attach
69
+ BreakBeforeConceptDeclarations: false
70
+ BreakBeforeInheritanceComma: false
69
71
BreakBeforeTernaryOperators: true
70
72
BreakConstructorInitializers: BeforeColon
73
+ BreakConstructorInitializersBeforeComma: false
71
74
BreakInheritanceList: BeforeColon
72
75
BreakStringLiterals: false
73
76
ColumnLimit: 0
74
- # "" matches none
75
- CommentPragmas: ""
77
+ CommentPragmas: ''
76
78
CompactNamespaces: false
77
- ConstructorInitializerAllOnOneLineOrOnePerLine: true
79
+ ConstructorInitializerAllOnOneLineOrOnePerLine: false
78
80
ConstructorInitializerIndentWidth: 2
79
81
ContinuationIndentWidth: 2
80
82
Cpp11BracedListStyle: false
81
83
DeriveLineEnding: true
82
84
DerivePointerAlignment: true
83
85
DisableFormat: 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
86
89
FixNamespaceComments: false
87
- ForEachMacros: []
90
+ ForEachMacros:
91
+ - foreach
92
+ - Q_FOREACH
93
+ - BOOST_FOREACH
94
+ IfMacros:
95
+ - KJ_IF_MAYBE
88
96
IncludeBlocks: 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
93
113
IndentCaseBlocks: true
94
114
IndentCaseLabels: true
95
115
IndentExternBlock: Indent
96
116
IndentGotoLabels: false
97
117
IndentPPDirectives: None
118
+ IndentRequires: true
98
119
IndentWidth: 2
99
120
IndentWrappedFunctionNames: false
100
121
InsertTrailingCommas: None
101
- # Java-specific
102
- #JavaImportGroups:
103
- # JavaScript-specific
104
- #JavaScriptQuotes:
105
- #JavaScriptWrapImports
122
+ JavaScriptQuotes: Leave
123
+ JavaScriptWrapImports: true
106
124
KeepEmptyLinesAtTheStartOfBlocks: true
107
- MacroBlockBegin: ""
108
- MacroBlockEnd: ""
109
- # Set to a large number to effectively disable
125
+ LambdaBodyIndentation: Signature
126
+ Language: Cpp
127
+ MacroBlockBegin: ''
128
+ MacroBlockEnd: ''
110
129
MaxEmptyLinesToKeep: 100000
111
130
NamespaceIndentation: 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
119
138
PenaltyBreakAssignment: 1
120
139
PenaltyBreakBeforeFirstCallParameter: 1
121
140
PenaltyBreakComment: 1
122
141
PenaltyBreakFirstLessLess: 1
142
+ PenaltyBreakOpenParenthesis: 1
123
143
PenaltyBreakString: 1
124
144
PenaltyBreakTemplateDeclaration: 1
125
145
PenaltyExcessCharacter: 1
146
+ PenaltyIndentedWhitespace: 1
126
147
PenaltyReturnTypeOnItsOwnLine: 1
127
- # Used as a fallback if alignment style can't be detected from code (DerivePointerAlignment: true)
128
148
PointerAlignment: Right
129
- RawStringFormats: []
149
+ QualifierAlignment: Leave
150
+ ReferenceAlignment: Pointer
130
151
ReflowComments: false
131
- SortIncludes: false
152
+ RemoveBracesLLVM: false
153
+ SeparateDefinitionBlocks: Leave
154
+ ShortNamespaceLines: 0
155
+ SortIncludes: Never
156
+ SortJavaStaticImport: Before
132
157
SortUsingDeclarations: false
133
158
SpaceAfterCStyleCast: false
134
159
SpaceAfterLogicalNot: false
135
160
SpaceAfterTemplateKeyword: false
161
+ SpaceAroundPointerQualifiers: Default
136
162
SpaceBeforeAssignmentOperators: true
163
+ SpaceBeforeCaseColon: false
137
164
SpaceBeforeCpp11BracedList: false
138
165
SpaceBeforeCtorInitializerColon: true
139
166
SpaceBeforeInheritanceColon: true
140
167
SpaceBeforeParens: ControlStatements
168
+ SpaceBeforeParensOptions:
169
+ AfterControlStatements: true
170
+ AfterForeachMacros: true
171
+ AfterFunctionDefinitionName: false
172
+ AfterFunctionDeclarationName: false
173
+ AfterIfMacros: true
174
+ AfterOverloadedOperator: false
175
+ BeforeNonEmptyParentheses: false
141
176
SpaceBeforeRangeBasedForLoopColon: true
142
177
SpaceBeforeSquareBrackets: false
143
178
SpaceInEmptyBlock: false
144
179
SpaceInEmptyParentheses: false
145
180
SpacesBeforeTrailingComments: 2
146
- SpacesInAngles: false
181
+ SpacesInAngles: Leave
147
182
SpacesInCStyleCastParentheses: false
148
183
SpacesInConditionalStatement: false
149
184
SpacesInContainerLiterals: false
185
+ SpacesInLineCommentPrefix:
186
+ Minimum: 0
187
+ Maximum: -1
150
188
SpacesInParentheses: false
151
189
SpacesInSquareBrackets: false
152
190
Standard: Auto
153
- StatementMacros: []
191
+ StatementAttributeLikeMacros:
192
+ - Q_EMIT
193
+ StatementMacros:
194
+ - Q_UNUSED
195
+ - QT_REQUIRE_VERSION
154
196
TabWidth: 2
155
- TypenameMacros: []
156
- # Default to LF if line endings can't be detected from the content (DeriveLineEnding).
157
197
UseCRLF: false
158
198
UseTab: Never
159
- WhitespaceSensitiveMacros: []
199
+ WhitespaceSensitiveMacros:
200
+ - STRINGIZE
201
+ - PP_STRINGIZE
202
+ - BOOST_PP_STRINGIZE
203
+ - NS_SWIFT_NAME
204
+ - CF_SWIFT_NAME
160
205
`
161
206
try := func (conf * paths.Path ) bool {
162
207
if c , err := conf .ReadFile (); err != nil {
0 commit comments