Skip to content

Commit cacc78d

Browse files
authored
Replace IDE 2.x configuration file content with link to source
Arduino IDE 2.x allows the user to customize the output of the "Auto Format" feature via a configuration file. This system is documented in the "Customizing the Auto Formatter Feature" tutorial. When the user customizes the formatter, their configuration file is used exclusively by the formatter tool rather than being merged into the standard configuration. Since the user is likely only interested in modifying a small number of specific aspect of the standard configuration (e.g., wishing to use "broken" rather than "attached" braces), they will find it convenient to use Arduino's standard configuration as a base for their custom configuration. For this reason, the standard configuration is offered in the tutorial. Previously, the full YAML code of the standard configuration was included in the tutorial page itself. This was the best approach at the time the tutorial was created because what was the canonical source in the Arduino IDE code base is in a format not usable in this application. Since that time, the ClangFormat native YAML file has been published in a dedicated permanent location where it is hosted as the canonical source for all projects that use the configuration. This enabled the removal of the configuration code from the tutorial, replaced by a link to the source file. This change provides the following benefits: ### Reduce maintenance burden The configuration code must be updated periodically in parallel to bumps of the version of ClangFormat used by Arduino IDE 2.x and other Arduino development tools. This is handled as a matter of course in the canonical source file, but the copy hosted in the tutorial content would have needed updates as well (or else become outdated). Pointing the reader to the source ensures they will always have the current configuration without any need to maintain the documentation content. ### Improves approachability of tutorial The configuration code added a large block of complex YAML to the tutorial. Although it will be necessary for the reader to eventually work with this code, they don't have any need to browse through it while reading the tutorial. So having the code as part of the tutorial content didn't add anything of value and also harmed the readability.
1 parent 8d5c64c commit cacc78d

File tree

1 file changed

+1
-146
lines changed
  • content/software/ide-v2/tutorials/ide-v2-customize-auto-formatter

1 file changed

+1
-146
lines changed

Diff for: content/software/ide-v2/tutorials/ide-v2-customize-auto-formatter/content.md

+1-146
Original file line numberDiff line numberDiff line change
@@ -65,152 +65,7 @@ Here you can find the default formatting file used in the Arduino IDE 2.0. If yo
6565

6666
***Please note that the custom configuration file completely overrides the Arduino default configuration, rather than merging with it. Any configuration option you don't set in your custom file will be set to the ClangFormat default value.***
6767

68-
```cpp
69-
---
70-
Language: Cpp
71-
# LLVM is the default style setting, used when a configuration option is not set here
72-
BasedOnStyle: LLVM
73-
AccessModifierOffset: -2
74-
AlignAfterOpenBracket: Align
75-
AlignConsecutiveAssignments: false
76-
AlignConsecutiveBitFields: false
77-
AlignConsecutiveDeclarations: false
78-
AlignConsecutiveMacros: false
79-
AlignEscapedNewlines: DontAlign
80-
AlignOperands: Align
81-
AlignTrailingComments: true
82-
AllowAllArgumentsOnNextLine: true
83-
AllowAllConstructorInitializersOnNextLine: true
84-
AllowAllParametersOfDeclarationOnNextLine: true
85-
AllowShortBlocksOnASingleLine: Always
86-
AllowShortCaseLabelsOnASingleLine: true
87-
AllowShortEnumsOnASingleLine: true
88-
AllowShortFunctionsOnASingleLine: Empty
89-
AllowShortIfStatementsOnASingleLine: Always
90-
AllowShortLambdasOnASingleLine: Empty
91-
AllowShortLoopsOnASingleLine: true
92-
AlwaysBreakAfterDefinitionReturnType: None
93-
AlwaysBreakAfterReturnType: None
94-
AlwaysBreakBeforeMultilineStrings: false
95-
AlwaysBreakTemplateDeclarations: No
96-
BinPackArguments: true
97-
BinPackParameters: true
98-
# Only used when "BreakBeforeBraces" set to "Custom"
99-
BraceWrapping:
100-
AfterCaseLabel: false
101-
AfterClass: false
102-
AfterControlStatement: Never
103-
AfterEnum: false
104-
AfterFunction: false
105-
AfterNamespace: false
106-
#AfterObjCDeclaration:
107-
AfterStruct: false
108-
AfterUnion: false
109-
AfterExternBlock: false
110-
BeforeCatch: false
111-
BeforeElse: false
112-
BeforeLambdaBody: false
113-
BeforeWhile: false
114-
IndentBraces: false
115-
SplitEmptyFunction: false
116-
SplitEmptyRecord: false
117-
SplitEmptyNamespace: false
118-
# Java-specific
119-
#BreakAfterJavaFieldAnnotations:
120-
BreakBeforeBinaryOperators: NonAssignment
121-
BreakBeforeBraces: Attach
122-
BreakBeforeTernaryOperators: true
123-
BreakConstructorInitializers: BeforeColon
124-
BreakInheritanceList: BeforeColon
125-
BreakStringLiterals: false
126-
ColumnLimit: 0
127-
# "" matches none
128-
CommentPragmas: ""
129-
CompactNamespaces: false
130-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
131-
ConstructorInitializerIndentWidth: 2
132-
ContinuationIndentWidth: 2
133-
Cpp11BracedListStyle: false
134-
DeriveLineEnding: true
135-
DerivePointerAlignment: true
136-
DisableFormat: false
137-
# Docs say "Do not use this in config files". The default (LLVM 11.0.1) is "false".
138-
#ExperimentalAutoDetectBinPacking:
139-
FixNamespaceComments: false
140-
ForEachMacros: []
141-
IncludeBlocks: Preserve
142-
IncludeCategories: []
143-
# "" matches none
144-
IncludeIsMainRegex: ""
145-
IncludeIsMainSourceRegex: ""
146-
IndentCaseBlocks: true
147-
IndentCaseLabels: true
148-
IndentExternBlock: Indent
149-
IndentGotoLabels: false
150-
IndentPPDirectives: None
151-
IndentWidth: 2
152-
IndentWrappedFunctionNames: false
153-
InsertTrailingCommas: None
154-
# Java-specific
155-
#JavaImportGroups:
156-
# JavaScript-specific
157-
#JavaScriptQuotes:
158-
#JavaScriptWrapImports
159-
KeepEmptyLinesAtTheStartOfBlocks: true
160-
MacroBlockBegin: ""
161-
MacroBlockEnd: ""
162-
# Set to a large number to effectively disable
163-
MaxEmptyLinesToKeep: 100000
164-
NamespaceIndentation: None
165-
NamespaceMacros: []
166-
# Objective C-specific
167-
#ObjCBinPackProtocolList:
168-
#ObjCBlockIndentWidth:
169-
#ObjCBreakBeforeNestedBlockParam:
170-
#ObjCSpaceAfterProperty:
171-
#ObjCSpaceBeforeProtocolList
172-
PenaltyBreakAssignment: 1
173-
PenaltyBreakBeforeFirstCallParameter: 1
174-
PenaltyBreakComment: 1
175-
PenaltyBreakFirstLessLess: 1
176-
PenaltyBreakString: 1
177-
PenaltyBreakTemplateDeclaration: 1
178-
PenaltyExcessCharacter: 1
179-
PenaltyReturnTypeOnItsOwnLine: 1
180-
# Used as a fallback if alignment style can't be detected from code (DerivePointerAlignment: true)
181-
PointerAlignment: Right
182-
RawStringFormats: []
183-
ReflowComments: false
184-
SortIncludes: false
185-
SortUsingDeclarations: false
186-
SpaceAfterCStyleCast: false
187-
SpaceAfterLogicalNot: false
188-
SpaceAfterTemplateKeyword: false
189-
SpaceBeforeAssignmentOperators: true
190-
SpaceBeforeCpp11BracedList: false
191-
SpaceBeforeCtorInitializerColon: true
192-
SpaceBeforeInheritanceColon: true
193-
SpaceBeforeParens: ControlStatements
194-
SpaceBeforeRangeBasedForLoopColon: true
195-
SpaceBeforeSquareBrackets: false
196-
SpaceInEmptyBlock: false
197-
SpaceInEmptyParentheses: false
198-
SpacesBeforeTrailingComments: 2
199-
SpacesInAngles: false
200-
SpacesInCStyleCastParentheses: false
201-
SpacesInConditionalStatement: false
202-
SpacesInContainerLiterals: false
203-
SpacesInParentheses: false
204-
SpacesInSquareBrackets: false
205-
Standard: Auto
206-
StatementMacros: []
207-
TabWidth: 2
208-
TypenameMacros: []
209-
# Default to LF if line endings can't be detected from the content (DeriveLineEnding).
210-
UseCRLF: false
211-
UseTab: Never
212-
WhitespaceSensitiveMacros: []
213-
```
68+
https://raw.githubusercontent.com/arduino/tooling-project-assets/main/other/clang-format-configuration/.clang-format
21469

21570
## Conclusion
21671

0 commit comments

Comments
 (0)