-
-
Notifications
You must be signed in to change notification settings - Fork 469
Use unmodified official ClangFormat configuration as base formatter configuration #1324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
923f5c6
Use unmodified official ClangFormat configuration as base formatter c…
per1234 becb901
Correct relative path to formatter configuration file
per1234 aff3560
Remove unnecessary comments from formatter code
per1234 fe51711
Format formatter configuration with prettier
per1234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Use unmodified official ClangFormat configuration as base formatter c…
…onfiguration The Arduino IDE's "Auto Format" feature is configured to produce the standard Arduino sketch formatting style by default. The Arduino IDE editor's default settings are compliant with that style. However, the user may adjust the editor settings. In this case, the Arduino IDE automatically adjusts the Auto Format configuration to align with the user's preferences. The formatter configuration is consumed by several other projects in addition to the Arduino IDE. For this reason, the configuration is hosted and maintained in a centralized location, from which it is pulled by all projects that use it. Previously, the adjustment of the Arduino IDE formatter configuration according to the editor settings was integrated into the configuration object itself. This meant that the standardized configuration had to be modified each time it was pulled in to sync from the upstream source. Moving the base formatter configuration object to a dedicated file, separated from the handling and adjustment code allows syncs to be done by simply replacing the existing configuration file with the one automatically generated by the CI system of the repository where the source configuration is hosted.
- Loading branch information
commit 923f5c6b4e7cc8b6558b8580ca9ef999ebfef497
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
206 changes: 206 additions & 0 deletions
206
arduino-ide-extension/src/node/default-formatter-config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
{ | ||
"AccessModifierOffset": -2, | ||
"AlignAfterOpenBracket": "Align", | ||
"AlignArrayOfStructures": "None", | ||
"AlignConsecutiveAssignments": "None", | ||
"AlignConsecutiveBitFields": "None", | ||
"AlignConsecutiveDeclarations": "None", | ||
"AlignConsecutiveMacros": "None", | ||
"AlignEscapedNewlines": "DontAlign", | ||
"AlignOperands": "Align", | ||
"AlignTrailingComments": true, | ||
"AllowAllArgumentsOnNextLine": true, | ||
"AllowAllConstructorInitializersOnNextLine": true, | ||
"AllowAllParametersOfDeclarationOnNextLine": true, | ||
"AllowShortBlocksOnASingleLine": "Always", | ||
"AllowShortCaseLabelsOnASingleLine": true, | ||
"AllowShortEnumsOnASingleLine": true, | ||
"AllowShortFunctionsOnASingleLine": "Empty", | ||
"AllowShortIfStatementsOnASingleLine": "AllIfsAndElse", | ||
"AllowShortLambdasOnASingleLine": "Empty", | ||
"AllowShortLoopsOnASingleLine": true, | ||
"AlwaysBreakAfterDefinitionReturnType": "None", | ||
"AlwaysBreakAfterReturnType": "None", | ||
"AlwaysBreakBeforeMultilineStrings": false, | ||
"AlwaysBreakTemplateDeclarations": "No", | ||
"AttributeMacros": [ | ||
"__capability" | ||
], | ||
"BasedOnStyle": "LLVM", | ||
"BinPackArguments": true, | ||
"BinPackParameters": true, | ||
"BitFieldColonSpacing": "Both", | ||
"BraceWrapping": { | ||
"AfterCaseLabel": false, | ||
"AfterClass": false, | ||
"AfterControlStatement": "Never", | ||
"AfterEnum": false, | ||
"AfterFunction": false, | ||
"AfterNamespace": false, | ||
"AfterObjCDeclaration": false, | ||
"AfterStruct": false, | ||
"AfterUnion": false, | ||
"AfterExternBlock": false, | ||
"BeforeCatch": false, | ||
"BeforeElse": false, | ||
"BeforeLambdaBody": false, | ||
"BeforeWhile": false, | ||
"IndentBraces": false, | ||
"SplitEmptyFunction": true, | ||
"SplitEmptyRecord": true, | ||
"SplitEmptyNamespace": true | ||
}, | ||
"BreakAfterJavaFieldAnnotations": false, | ||
"BreakBeforeBinaryOperators": "NonAssignment", | ||
"BreakBeforeBraces": "Attach", | ||
"BreakBeforeConceptDeclarations": false, | ||
"BreakBeforeInheritanceComma": false, | ||
"BreakBeforeTernaryOperators": true, | ||
"BreakConstructorInitializers": "BeforeColon", | ||
"BreakConstructorInitializersBeforeComma": false, | ||
"BreakInheritanceList": "BeforeColon", | ||
"BreakStringLiterals": false, | ||
"ColumnLimit": 0, | ||
"CommentPragmas": "", | ||
"CompactNamespaces": false, | ||
"ConstructorInitializerAllOnOneLineOrOnePerLine": false, | ||
"ConstructorInitializerIndentWidth": 2, | ||
"ContinuationIndentWidth": 2, | ||
"Cpp11BracedListStyle": false, | ||
"DeriveLineEnding": true, | ||
"DerivePointerAlignment": true, | ||
"DisableFormat": false, | ||
"EmptyLineAfterAccessModifier": "Leave", | ||
"EmptyLineBeforeAccessModifier": "Leave", | ||
"ExperimentalAutoDetectBinPacking": false, | ||
"FixNamespaceComments": false, | ||
"ForEachMacros": [ | ||
"foreach", | ||
"Q_FOREACH", | ||
"BOOST_FOREACH" | ||
], | ||
"IfMacros": [ | ||
"KJ_IF_MAYBE" | ||
], | ||
"IncludeBlocks": "Preserve", | ||
"IncludeCategories": [ | ||
{ | ||
"Regex": "^\"(llvm|llvm-c|clang|clang-c)/", | ||
"Priority": 2, | ||
"SortPriority": 0, | ||
"CaseSensitive": false | ||
}, | ||
{ | ||
"Regex": "^(<|\"(gtest|gmock|isl|json)/)", | ||
"Priority": 3, | ||
"SortPriority": 0, | ||
"CaseSensitive": false | ||
}, | ||
{ | ||
"Regex": ".*", | ||
"Priority": 1, | ||
"SortPriority": 0, | ||
"CaseSensitive": false | ||
} | ||
], | ||
"IncludeIsMainRegex": "", | ||
"IncludeIsMainSourceRegex": "", | ||
"IndentAccessModifiers": false, | ||
"IndentCaseBlocks": true, | ||
"IndentCaseLabels": true, | ||
"IndentExternBlock": "Indent", | ||
"IndentGotoLabels": false, | ||
"IndentPPDirectives": "None", | ||
"IndentRequires": true, | ||
"IndentWidth": 2, | ||
"IndentWrappedFunctionNames": false, | ||
"InsertTrailingCommas": "None", | ||
"JavaScriptQuotes": "Leave", | ||
"JavaScriptWrapImports": true, | ||
"KeepEmptyLinesAtTheStartOfBlocks": true, | ||
"LambdaBodyIndentation": "Signature", | ||
"Language": "Cpp", | ||
"MacroBlockBegin": "", | ||
"MacroBlockEnd": "", | ||
"MaxEmptyLinesToKeep": 100000, | ||
"NamespaceIndentation": "None", | ||
"ObjCBinPackProtocolList": "Auto", | ||
"ObjCBlockIndentWidth": 2, | ||
"ObjCBreakBeforeNestedBlockParam": true, | ||
"ObjCSpaceAfterProperty": false, | ||
"ObjCSpaceBeforeProtocolList": true, | ||
"PPIndentWidth": -1, | ||
"PackConstructorInitializers": "BinPack", | ||
"PenaltyBreakAssignment": 1, | ||
"PenaltyBreakBeforeFirstCallParameter": 1, | ||
"PenaltyBreakComment": 1, | ||
"PenaltyBreakFirstLessLess": 1, | ||
"PenaltyBreakOpenParenthesis": 1, | ||
"PenaltyBreakString": 1, | ||
"PenaltyBreakTemplateDeclaration": 1, | ||
"PenaltyExcessCharacter": 1, | ||
"PenaltyIndentedWhitespace": 1, | ||
"PenaltyReturnTypeOnItsOwnLine": 1, | ||
"PointerAlignment": "Right", | ||
"QualifierAlignment": "Leave", | ||
"ReferenceAlignment": "Pointer", | ||
"ReflowComments": false, | ||
"RemoveBracesLLVM": false, | ||
"SeparateDefinitionBlocks": "Leave", | ||
"ShortNamespaceLines": 0, | ||
"SortIncludes": "Never", | ||
"SortJavaStaticImport": "Before", | ||
"SortUsingDeclarations": false, | ||
"SpaceAfterCStyleCast": false, | ||
"SpaceAfterLogicalNot": false, | ||
"SpaceAfterTemplateKeyword": false, | ||
"SpaceAroundPointerQualifiers": "Default", | ||
"SpaceBeforeAssignmentOperators": true, | ||
"SpaceBeforeCaseColon": false, | ||
"SpaceBeforeCpp11BracedList": false, | ||
"SpaceBeforeCtorInitializerColon": true, | ||
"SpaceBeforeInheritanceColon": true, | ||
"SpaceBeforeParens": "ControlStatements", | ||
"SpaceBeforeParensOptions": { | ||
"AfterControlStatements": true, | ||
"AfterForeachMacros": true, | ||
"AfterFunctionDefinitionName": false, | ||
"AfterFunctionDeclarationName": false, | ||
"AfterIfMacros": true, | ||
"AfterOverloadedOperator": false, | ||
"BeforeNonEmptyParentheses": false | ||
}, | ||
"SpaceBeforeRangeBasedForLoopColon": true, | ||
"SpaceBeforeSquareBrackets": false, | ||
"SpaceInEmptyBlock": false, | ||
"SpaceInEmptyParentheses": false, | ||
"SpacesBeforeTrailingComments": 2, | ||
"SpacesInAngles": "Leave", | ||
"SpacesInCStyleCastParentheses": false, | ||
"SpacesInConditionalStatement": false, | ||
"SpacesInContainerLiterals": false, | ||
"SpacesInLineCommentPrefix": { | ||
"Minimum": 0, | ||
"Maximum": -1 | ||
}, | ||
"SpacesInParentheses": false, | ||
"SpacesInSquareBrackets": false, | ||
"Standard": "Auto", | ||
"StatementAttributeLikeMacros": [ | ||
"Q_EMIT" | ||
], | ||
"StatementMacros": [ | ||
"Q_UNUSED", | ||
"QT_REQUIRE_VERSION" | ||
], | ||
"TabWidth": 2, | ||
"UseCRLF": false, | ||
"UseTab": "Never", | ||
"WhitespaceSensitiveMacros": [ | ||
"STRINGIZE", | ||
"PP_STRINGIZE", | ||
"BOOST_PP_STRINGIZE", | ||
"NS_SWIFT_NAME", | ||
"CF_SWIFT_NAME" | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be changed to, it's my fault. I found it only when verifying the behavior:
Explanation:
We write TS code that will be transpiled to JS code. IDE2 does not run TS code, only JS code. The sources (TS files, JSON, .etc) are in
src
, the transpiled JS code is inlib
.The TS sources and the JSON config are here:
The TS code will be JS, and the module location will be these:
Notice the
src
andlib
differences in the path. JSON files will remain insrc
at runtime, JS files will be inlib
folder. To be able torequire
the JSON file from the transpiled JS, therequire
path must be changed from./default-formatter-config.json
to../../src/node/default-formatter-config.json
. If this is not clear, please let me know.Also, please remove the
// 1. require the JSON
and the// 2. override the default values with the user-defined ones
comments. I added them for explanation purposes.Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I have done it here: becb901
I saw that when I went to test the build (I think I somehow ended up still old source code when I ran it from source).
I was going down the path mentioned here:
https://stackoverflow.com/a/53629381/7059512
(adding something like
"src/node/*.json"
to theinclude
field oftsconfig.json
)OK, done here: aff3560