clang-format configurator - 交互式创建 ClangFormat 格式化配置文件
clang-format configurator - 交互式创建 ClangFormat 格式化配置文件1. clang-format configurator2. clang-format configurator v23. Clang-Format Style Options3.1. AlignEscapedNewlines (EscapedNewlineAlignmentStyle)3.2. SortIncludes (SortIncludesOptions)3.3. AlwaysBreakBeforeMultilineStrings (Boolean)3.4. AlwaysBreakTemplateDeclarations (deprecated)3.5. AccessModifierOffset (Integer)References1. clang-format configuratorclang-format configuratorhttps://zed0.co.uk/clang-format-configurator/clang-format-configuratorhttps://github.com/zed0/clang-format-configuratorInteractively create a clang-format configuration while watching how the changes affect your code.以交互方式创建 clang-format 配置同时观察更改如何影响你的代码。2. clang-format configurator v2clang-format configurator v2https://clang-format-configurator.site/Clang-format-configurator-v2https://github.com/Wirena/clang-format-configurator-v2Interactively create a clang-format configuration while watching how the changes affect your code.Clang-format-configurator-v2 is a written from scratch successor of clang-format-configurator.3. Clang-Format Style Optionshttps://clang.llvm.org/docs/ClangFormatStyleOptions.htmlClang-Format Style Options describes configurable formatting style options supported by LibFormat and ClangFormat.3.1. AlignEscapedNewlines (EscapedNewlineAlignmentStyle)Options for aligning backslashes in escaped newlines.在转义换行符中对齐反斜杠的选项。Possible values:ENAS_DontAlign(in configuration:DontAlign) Don’t align escaped newlines.不要对齐转义的换行符。#define A \ int aaaa; \ int b; \ int dddddddddd;ENAS_Left(in configuration:Left) Align escaped newlines as far left as possible.尽可能向左对齐转义的换行符。#define A \ int aaaa; \ int b; \ int dddddddddd;ENAS_Right(in configuration:Right) Align escaped newlines in the right-most column.在最右边的列中对齐转义的换行符。#define A \ int aaaa; \ int b; \ int dddddddddd;3.2. SortIncludes (SortIncludesOptions)Controls if and how clang-format will sort#includes.Nested configuration flags:Includes sorting options.bool EnabledIftrue, includes are sorted based on the other suboptions below. (Neveris deprecated byEnabled: false.)bool IgnoreCaseWhether or not includes are sorted in a case-insensitive fashion. (CaseSensitiveandCaseInsensitiveare deprecated byIgnoreCase: falseandIgnoreCase: true, respectively.)true: false: #include A/B.h vs. #include A/B.h #include A/b.h #include A/b.h #include a/b.h #include B/A.h #include B/A.h #include B/a.h #include B/a.h #include a/b.hbool IgnoreExtensionWhen sorting includes in each block, only take file extensions into account if two includes compare equal otherwise.true: false: # include A.h vs. # include A-util.h # include A.inc # include A.h # include A-util.h # include A.inc3.3. AlwaysBreakBeforeMultilineStrings (Boolean)Iftrue, always break before multiline string literals.This flag is mean to make cases where there are multiple multiline strings in a file look more consistent. Thus, it will only take effect if wrapping the string at that point leads to it being indentedContinuationIndentWidthspaces from the start of the line.true: false: aaaa vs. aaaa bbbb bbbb cccc; cccc;3.4. AlwaysBreakTemplateDeclarations (deprecated)This option is renamed to BreakTemplateDeclarations.3.5. AccessModifierOffset (Integer)The extra indent or outdent of access modifiers, e.g.public:.References[1] Yongqiang Cheng (程永强), https://yongqiang.blog.csdn.net/[2] clang-format configurator - 交互式创建 ClangFormat 格式化配置文件, https://mp.weixin.qq.com/s/q9PNNl0l8Xmf6ZAwUphzbw