diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a62d0c..2f6423b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT - + echo "changelog<> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 207aa29..0143192 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,9 +2,17 @@ exclude: ^\.idea|\.run repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - id: check-shebang-scripts-are-executable + + # Python format and lint + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.4 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format diff --git a/README.md b/README.md index d95278c..1e5facf 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![Version](https://img.shields.io/jetbrains/plugin/v/20785-clang-format-tools.svg)](https://plugins.jetbrains.com/plugin/20785-clang-format-tools) [![Downloads](https://img.shields.io/jetbrains/plugin/d/20785-clang-format-tools.svg)](https://plugins.jetbrains.com/plugin/20785-clang-format-tools) [![codecov](https://codecov.io/github/aarcangeli/idea-clang-format/branch/main/graph/badge.svg?token=R9GW965X3Y)](https://codecov.io/github/aarcangeli/idea-clang-format) +![Static Badge](https://img.shields.io/badge/Get%20from%20Marketplace-blue?link=https%3A%2F%2Fplugins.jetbrains.com%2Fplugin%2F20785-clang-format-tools) + diff --git a/schemaGenerator/README.md b/schemaGenerator/README.md new file mode 100644 index 0000000..6f21345 --- /dev/null +++ b/schemaGenerator/README.md @@ -0,0 +1,16 @@ +# schema-generator + +Permits to generate a json schema from (clangFormat-options.json) from clang doxygen documentation. + +The relevant files are just the following: +- `Format.h` +- `IncludeStyle.h` + +### Usage + +```bash +python generate_schema.py --download +``` + +Options: +- `--download`: Download the latest source before generating the schema. diff --git a/schemaGenerator/clang/Format.h b/schemaGenerator/clang/Format.h index 514ef16..c454ab2 100644 --- a/schemaGenerator/clang/Format.h +++ b/schemaGenerator/clang/Format.h @@ -20,6 +20,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/Regex.h" #include "llvm/Support/SourceMgr.h" +#include #include namespace llvm { @@ -91,9 +92,10 @@ struct FormatStyle { /// ) /// \endcode /// - /// \warning - /// Note: This currently only applies to parentheses. - /// \endwarning + /// \note + /// This currently only applies to braced initializer lists (when + /// ``Cpp11BracedListStyle`` is ``true``) and parentheses. + /// \endnote BAS_BlockIndent, }; @@ -132,8 +134,10 @@ struct FormatStyle { /// if not ``None``, when using initialization for an array of structs /// aligns the fields into columns. /// - /// NOTE: As of clang-format 15 this option only applied to arrays with equal - /// number of columns per row. + /// \note + /// As of clang-format 15 this option only applied to arrays with equal + /// number of columns per row. + /// \endnote /// /// \version 13 ArrayInitializerAlignmentStyle AlignArrayOfStructures; @@ -150,9 +154,9 @@ struct FormatStyle { /// For example, to align across empty lines and not across comments, either /// of these work. /// \code - /// AlignConsecutiveMacros: AcrossEmptyLines + /// : AcrossEmptyLines /// - /// AlignConsecutiveMacros: + /// : /// Enabled: true /// AcrossEmptyLines: true /// AcrossComments: false @@ -221,6 +225,22 @@ struct FormatStyle { /// bbb = 2; /// \endcode bool AlignCompound; + /// Only for ``AlignConsecutiveDeclarations``. Whether function pointers are + /// aligned. + /// \code + /// true: + /// unsigned i; + /// int &r; + /// int *p; + /// int (*f)(); + /// + /// false: + /// unsigned i; + /// int &r; + /// int *p; + /// int (*f)(); + /// \endcode + bool AlignFunctionPointers; /// Only for ``AlignConsecutiveAssignments``. Whether short assignment /// operators are left-padded to the same length as long ones in order to /// put all assignment operators to the right of the left hand side. @@ -243,7 +263,9 @@ struct FormatStyle { bool operator==(const AlignConsecutiveStyle &R) const { return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines && AcrossComments == R.AcrossComments && - AlignCompound == R.AlignCompound && PadOperators == R.PadOperators; + AlignCompound == R.AlignCompound && + AlignFunctionPointers == R.AlignFunctionPointers && + PadOperators == R.PadOperators; } bool operator!=(const AlignConsecutiveStyle &R) const { return !(*this == R); @@ -295,6 +317,157 @@ struct FormatStyle { /// \version 3.8 AlignConsecutiveStyle AlignConsecutiveDeclarations; + /// Alignment options. + /// + struct ShortCaseStatementsAlignmentStyle { + /// Whether aligning is enabled. + /// \code + /// true: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// default: return ""; + /// } + /// + /// false: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// default: return ""; + /// } + /// \endcode + bool Enabled; + /// Whether to align across empty lines. + /// \code + /// true: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// + /// default: return ""; + /// } + /// + /// false: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// + /// default: return ""; + /// } + /// \endcode + bool AcrossEmptyLines; + /// Whether to align across comments. + /// \code + /// true: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// /* A comment. */ + /// default: return ""; + /// } + /// + /// false: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// /* A comment. */ + /// default: return ""; + /// } + /// \endcode + bool AcrossComments; + /// Whether to align the case arrows when aligning short case expressions. + /// \code{.java} + /// true: + /// i = switch (day) { + /// case THURSDAY, SATURDAY -> 8; + /// case WEDNESDAY -> 9; + /// default -> 0; + /// }; + /// + /// false: + /// i = switch (day) { + /// case THURSDAY, SATURDAY -> 8; + /// case WEDNESDAY -> 9; + /// default -> 0; + /// }; + /// \endcode + bool AlignCaseArrows; + /// Whether aligned case labels are aligned on the colon, or on the tokens + /// after the colon. + /// \code + /// true: + /// switch (level) { + /// case log::info : return "info:"; + /// case log::warning: return "warning:"; + /// default : return ""; + /// } + /// + /// false: + /// switch (level) { + /// case log::info: return "info:"; + /// case log::warning: return "warning:"; + /// default: return ""; + /// } + /// \endcode + bool AlignCaseColons; + bool operator==(const ShortCaseStatementsAlignmentStyle &R) const { + return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines && + AcrossComments == R.AcrossComments && + AlignCaseArrows == R.AlignCaseArrows && + AlignCaseColons == R.AlignCaseColons; + } + }; + + /// Style of aligning consecutive short case labels. + /// Only applies if ``AllowShortCaseExpressionOnASingleLine`` or + /// ``AllowShortCaseLabelsOnASingleLine`` is ``true``. + /// + /// \code{.yaml} + /// # Example of usage: + /// AlignConsecutiveShortCaseStatements: + /// Enabled: true + /// AcrossEmptyLines: true + /// AcrossComments: true + /// AlignCaseColons: false + /// \endcode + /// \version 17 + ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements; + + /// Style of aligning consecutive TableGen DAGArg operator colons. + /// If enabled, align the colon inside DAGArg which have line break inside. + /// This works only when TableGenBreakInsideDAGArg is BreakElements or + /// BreakAll and the DAGArg is not excepted by + /// TableGenBreakingDAGArgOperators's effect. + /// \code + /// let dagarg = (ins + /// a :$src1, + /// aa :$src2, + /// aaa:$src3 + /// ) + /// \endcode + /// \version 19 + AlignConsecutiveStyle AlignConsecutiveTableGenBreakingDAGArgColons; + + /// Style of aligning consecutive TableGen cond operator colons. + /// Align the colons of cases inside !cond operators. + /// \code + /// !cond(!eq(size, 1) : 1, + /// !eq(size, 16): 1, + /// true : 0) + /// \endcode + /// \version 19 + AlignConsecutiveStyle AlignConsecutiveTableGenCondOperatorColons; + + /// Style of aligning consecutive TableGen definition colons. + /// This aligns the inheritance colons of consecutive definitions. + /// \code + /// def Def : Parent {} + /// def DefDef : Parent {} + /// def DefDefDef : Parent {} + /// \endcode + /// \version 19 + AlignConsecutiveStyle AlignConsecutiveTableGenDefinitionColons; + /// Different styles for aligning escaped newlines. enum EscapedNewlineAlignmentStyle : int8_t { /// Don't align escaped newlines. @@ -307,15 +480,21 @@ struct FormatStyle { ENAS_DontAlign, /// Align escaped newlines as far left as possible. /// \code - /// true: /// #define A \ /// int aaaa; \ /// int b; \ /// int dddddddddd; - /// - /// false: /// \endcode ENAS_Left, + /// Align escaped newlines as far left as possible, using the last line of + /// the preprocessor directive as the reference if it's the longest. + /// \code + /// #define A \ + /// int aaaa; \ + /// int b; \ + /// int dddddddddd; + /// \endcode + ENAS_LeftWithLastLine, /// Align escaped newlines in the right-most column. /// \code /// #define A \ @@ -438,8 +617,14 @@ struct FormatStyle { /// Control of trailing comments. /// - /// NOTE: As of clang-format 16 this option is not a bool but can be set - /// to the options. Conventional bool options still can be parsed as before. + /// The alignment stops at closing braces after a line break, and only + /// followed by other closing braces, a (``do-``) ``while``, a lambda call, or + /// a semicolon. + /// + /// \note + /// As of clang-format 16 this option is not a bool but can be set + /// to the options. Conventional bool options still can be parsed as before. + /// \endnote /// /// \code{.yaml} /// # Example of usage: @@ -490,6 +675,47 @@ struct FormatStyle { /// \version 3.3 bool AllowAllParametersOfDeclarationOnNextLine; + /// Different ways to break before a noexcept specifier. + enum BreakBeforeNoexceptSpecifierStyle : int8_t { + /// No line break allowed. + /// \code + /// void foo(int arg1, + /// double arg2) noexcept; + /// + /// void bar(int arg1, double arg2) noexcept( + /// noexcept(baz(arg1)) && + /// noexcept(baz(arg2))); + /// \endcode + BBNSS_Never, + /// For a simple ``noexcept`` there is no line break allowed, but when we + /// have a condition it is. + /// \code + /// void foo(int arg1, + /// double arg2) noexcept; + /// + /// void bar(int arg1, double arg2) + /// noexcept(noexcept(baz(arg1)) && + /// noexcept(baz(arg2))); + /// \endcode + BBNSS_OnlyWithParen, + /// Line breaks are allowed. But note that because of the associated + /// penalties ``clang-format`` often prefers not to break before the + /// ``noexcept``. + /// \code + /// void foo(int arg1, + /// double arg2) noexcept; + /// + /// void bar(int arg1, double arg2) + /// noexcept(noexcept(baz(arg1)) && + /// noexcept(baz(arg2))); + /// \endcode + BBNSS_Always, + }; + + /// Controls if there could be a line break before a ``noexcept`` specifier. + /// \version 18 + BreakBeforeNoexceptSpecifierStyle AllowBreakBeforeNoexceptSpecifier; + /// Different styles for merging short blocks containing at most one /// statement. enum ShortBlockStyle : int8_t { @@ -523,6 +749,19 @@ struct FormatStyle { /// \version 3.5 ShortBlockStyle AllowShortBlocksOnASingleLine; + /// Whether to merge a short switch labeled rule into a single line. + /// \code{.java} + /// true: false: + /// switch (a) { vs. switch (a) { + /// case 1 -> 1; case 1 -> + /// default -> 0; 1; + /// }; default -> + /// 0; + /// }; + /// \endcode + /// \version 19 + bool AllowShortCaseExpressionOnASingleLine; + /// If ``true``, short case labels will be contracted to a single line. /// \code /// true: false: @@ -537,6 +776,25 @@ struct FormatStyle { /// \version 3.6 bool AllowShortCaseLabelsOnASingleLine; + /// Allow short compound requirement on a single line. + /// \code + /// true: + /// template + /// concept c = requires(T x) { + /// { x + 1 } -> std::same_as; + /// }; + /// + /// false: + /// template + /// concept c = requires(T x) { + /// { + /// x + 1 + /// } -> std::same_as; + /// }; + /// \endcode + /// \version 18 + bool AllowShortCompoundRequirementOnASingleLine; + /// Allow short enums on a single line. /// \code /// true: @@ -556,8 +814,8 @@ struct FormatStyle { enum ShortFunctionStyle : int8_t { /// Never merge functions into a single line. SFS_None, - /// Only merge functions defined inside a class. Same as "inline", - /// except it does not implies "empty": i.e. top level empty functions + /// Only merge functions defined inside a class. Same as ``inline``, + /// except it does not implies ``empty``: i.e. top level empty functions /// are not merged either. /// \code /// class Foo { @@ -578,7 +836,7 @@ struct FormatStyle { /// } /// \endcode SFS_Empty, - /// Only merge functions defined inside a class. Implies "empty". + /// Only merge functions defined inside a class. Implies ``empty``. /// \code /// class Foo { /// void f() { foo(); } @@ -729,16 +987,31 @@ struct FormatStyle { /// Different ways to break after the function definition or /// declaration return type. enum ReturnTypeBreakingStyle : int8_t { - /// Break after return type automatically. - /// ``PenaltyReturnTypeOnItsOwnLine`` is taken into account. + /// This is **deprecated**. See ``Automatic`` below. + RTBS_None, + /// Break after return type based on ``PenaltyReturnTypeOnItsOwnLine``. /// \code /// class A { /// int f() { return 0; }; /// }; /// int f(); /// int f() { return 1; } + /// int + /// LongName::AnotherLongName(); /// \endcode - RTBS_None, + RTBS_Automatic, + /// Same as ``Automatic`` above, except that there is no break after short + /// return types. + /// \code + /// class A { + /// int f() { return 0; }; + /// }; + /// int f(); + /// int f() { return 1; } + /// int LongName:: + /// AnotherLongName(); + /// \endcode + RTBS_ExceptShortType, /// Always break after the return type. /// \code /// class A { @@ -753,6 +1026,8 @@ struct FormatStyle { /// f() { /// return 1; /// } + /// int + /// LongName::AnotherLongName(); /// \endcode RTBS_All, /// Always break after the return types of top-level functions. @@ -766,6 +1041,8 @@ struct FormatStyle { /// f() { /// return 1; /// } + /// int + /// LongName::AnotherLongName(); /// \endcode RTBS_TopLevel, /// Always break after the return type of function definitions. @@ -781,6 +1058,8 @@ struct FormatStyle { /// f() { /// return 1; /// } + /// int + /// LongName::AnotherLongName(); /// \endcode RTBS_AllDefinitions, /// Always break after the return type of top-level definitions. @@ -793,6 +1072,8 @@ struct FormatStyle { /// f() { /// return 1; /// } + /// int + /// LongName::AnotherLongName(); /// \endcode RTBS_TopLevelDefinitions, }; @@ -802,9 +1083,10 @@ struct FormatStyle { /// \version 3.7 DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType; - /// The function declaration return type breaking style to use. + /// This option is renamed to ``BreakAfterReturnType``. /// \version 3.8 - ReturnTypeBreakingStyle AlwaysBreakAfterReturnType; + /// @deprecated + // ReturnTypeBreakingStyle AlwaysBreakAfterReturnType; /// If ``true``, always break before multiline string literals. /// @@ -823,6 +1105,16 @@ struct FormatStyle { /// Different ways to break after the template declaration. enum BreakTemplateDeclarationsStyle : int8_t { + /// Do not change the line breaking before the declaration. + /// \code + /// template + /// T foo() { + /// } + /// template T foo(int aaaaaaaaaaaaaaaaaaaaa, + /// int bbbbbbbbbbbbbbbbbbbbb) { + /// } + /// \endcode + BTDS_Leave, /// Do not force break before declaration. /// ``PenaltyBreakTemplateDeclaration`` is taken into account. /// \code @@ -857,9 +1149,10 @@ struct FormatStyle { BTDS_Yes }; - /// The template declaration breaking style to use. + /// This option is renamed to ``BreakTemplateDeclarations``. /// \version 3.4 - BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations; + /// @deprecated + // BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations; /// A vector of strings that should be interpreted as attributes/qualifiers /// instead of identifiers. This can be useful for language extensions or @@ -868,13 +1161,13 @@ struct FormatStyle { /// For example: /// \code /// x = (char *__capability)&y; - /// int function(void) __ununsed; + /// int function(void) __unused; /// void only_writes_to_buffer(char *__output buffer); /// \endcode /// /// In the .clang-format configuration file, this can be configured like: /// \code{.yaml} - /// AttributeMacros: ['__capability', '__output', '__ununsed'] + /// AttributeMacros: [__capability, __output, __unused] /// \endcode /// /// \version 12 @@ -943,6 +1236,39 @@ struct FormatStyle { /// \version 12 BitFieldColonSpacingStyle BitFieldColonSpacing; + /// The number of columns to use to indent the contents of braced init lists. + /// If unset, ``ContinuationIndentWidth`` is used. + /// \code + /// AlignAfterOpenBracket: AlwaysBreak + /// BracedInitializerIndentWidth: 2 + /// + /// void f() { + /// SomeClass c{ + /// "foo", + /// "bar", + /// "baz", + /// }; + /// auto s = SomeStruct{ + /// .foo = "foo", + /// .bar = "bar", + /// .baz = "baz", + /// }; + /// SomeArrayT a[3] = { + /// { + /// foo, + /// bar, + /// }, + /// { + /// foo, + /// bar, + /// }, + /// SomeArrayT{}, + /// }; + /// } + /// \endcode + /// \version 17 + std::optional BracedInitializerIndentWidth; + /// Different ways to wrap braces after control statements. enum BraceWrappingAfterControlStatementStyle : int8_t { /// Never wrap braces after a control statement. @@ -1059,8 +1385,10 @@ struct FormatStyle { /// \endcode bool AfterNamespace; /// Wrap ObjC definitions (interfaces, implementations...). - /// \note @autoreleasepool and @synchronized blocks are wrapped - /// according to `AfterControlStatement` flag. + /// \note + /// @autoreleasepool and @synchronized blocks are wrapped + /// according to ``AfterControlStatement`` flag. + /// \endnote bool AfterObjCDeclaration; /// Wrap struct definitions. /// \code @@ -1169,9 +1497,10 @@ struct FormatStyle { bool IndentBraces; /// If ``false``, empty function body can be put on a single line. /// This option is used only if the opening brace of the function has - /// already been wrapped, i.e. the `AfterFunction` brace wrapping mode is + /// already been wrapped, i.e. the ``AfterFunction`` brace wrapping mode is /// set, and the function could/should not be put on a single line (as per - /// `AllowShortFunctionsOnASingleLine` and constructor formatting options). + /// ``AllowShortFunctionsOnASingleLine`` and constructor formatting + /// options). /// \code /// false: true: /// int f() vs. int f() @@ -1182,7 +1511,7 @@ struct FormatStyle { bool SplitEmptyFunction; /// If ``false``, empty record (e.g. class, struct or union) body /// can be put on a single line. This option is used only if the opening - /// brace of the record has already been wrapped, i.e. the `AfterClass` + /// brace of the record has already been wrapped, i.e. the ``AfterClass`` /// (for classes) brace wrapping mode is set. /// \code /// false: true: @@ -1194,7 +1523,7 @@ struct FormatStyle { bool SplitEmptyRecord; /// If ``false``, empty namespace body can be put on a single line. /// This option is used only if the opening brace of the namespace has - /// already been wrapped, i.e. the `AfterNamespace` brace wrapping mode is + /// already been wrapped, i.e. the ``AfterNamespace`` brace wrapping mode is /// set. /// \code /// false: true: @@ -1221,11 +1550,117 @@ struct FormatStyle { /// \version 3.8 BraceWrappingFlags BraceWrapping; - /// If ``true``, clang-format will always break after a Json array `[` - /// otherwise it will scan until the closing `]` to determine if it should add - /// newlines between elements (prettier compatible). + /// Break between adjacent string literals. + /// \code + /// true: + /// return "Code" + /// "\0\52\26\55\55\0" + /// "x013" + /// "\02\xBA"; + /// false: + /// return "Code" "\0\52\26\55\55\0" "x013" "\02\xBA"; + /// \endcode + /// \version 18 + bool BreakAdjacentStringLiterals; + + /// Different ways to break after attributes. + enum AttributeBreakingStyle : int8_t { + /// Always break after attributes. + /// \code + /// [[maybe_unused]] + /// const int i; + /// [[gnu::const]] [[maybe_unused]] + /// int j; + /// + /// [[nodiscard]] + /// inline int f(); + /// [[gnu::const]] [[nodiscard]] + /// int g(); + /// + /// [[likely]] + /// if (a) + /// f(); + /// else + /// g(); + /// + /// switch (b) { + /// [[unlikely]] + /// case 1: + /// ++b; + /// break; + /// [[likely]] + /// default: + /// return; + /// } + /// \endcode + ABS_Always, + /// Leave the line breaking after attributes as is. + /// \code + /// [[maybe_unused]] const int i; + /// [[gnu::const]] [[maybe_unused]] + /// int j; + /// + /// [[nodiscard]] inline int f(); + /// [[gnu::const]] [[nodiscard]] + /// int g(); + /// + /// [[likely]] if (a) + /// f(); + /// else + /// g(); + /// + /// switch (b) { + /// [[unlikely]] case 1: + /// ++b; + /// break; + /// [[likely]] + /// default: + /// return; + /// } + /// \endcode + ABS_Leave, + /// Never break after attributes. + /// \code + /// [[maybe_unused]] const int i; + /// [[gnu::const]] [[maybe_unused]] int j; + /// + /// [[nodiscard]] inline int f(); + /// [[gnu::const]] [[nodiscard]] int g(); + /// + /// [[likely]] if (a) + /// f(); + /// else + /// g(); + /// + /// switch (b) { + /// [[unlikely]] case 1: + /// ++b; + /// break; + /// [[likely]] default: + /// return; + /// } + /// \endcode + ABS_Never, + }; + + /// Break after a group of C++11 attributes before variable or function + /// (including constructor/destructor) declaration/definition names or before + /// control statements, i.e. ``if``, ``switch`` (including ``case`` and + /// ``default`` labels), ``for``, and ``while`` statements. + /// \version 16 + AttributeBreakingStyle BreakAfterAttributes; + + /// The function declaration return type breaking style to use. + /// \version 19 + ReturnTypeBreakingStyle BreakAfterReturnType; + + /// If ``true``, clang-format will always break after a Json array ``[`` + /// otherwise it will scan until the closing ``]`` to determine if it should + /// add newlines between elements (prettier compatible). /// - /// NOTE: This is currently only for formatting JSON. + /// \note + /// This is currently only for formatting JSON. + /// \endnote /// \code /// true: false: /// [ vs. [1, 2, 3, 4] @@ -1720,7 +2155,7 @@ struct FormatStyle { /// } // namespace N /// \endcode BS_WebKit, - /// Configure each individual brace in `BraceWrapping`. + /// Configure each individual brace in ``BraceWrapping``. BS_Custom }; @@ -1737,7 +2172,7 @@ struct FormatStyle { BBCDS_Never, /// Breaking between template declaration and ``concept`` is allowed. The /// actual behavior depends on the content and line breaking rules and - /// penalities. + /// penalties. BBCDS_Allowed, /// Always break before ``concept``, putting it in the line after the /// template declaration. @@ -1826,6 +2261,20 @@ struct FormatStyle { /// \version 5 BreakConstructorInitializersStyle BreakConstructorInitializers; + /// If ``true``, clang-format will always break before function definition + /// parameters. + /// \code + /// true: + /// void functionDefinition( + /// int A, int B) {} + /// + /// false: + /// void functionDefinition(int A, int B) {} + /// + /// \endcode + /// \version 19 + bool BreakFunctionDefinitionParameters; + /// Break after each annotation on a field in Java files. /// \code{.java} /// true: false: @@ -1837,6 +2286,8 @@ struct FormatStyle { bool BreakAfterJavaFieldAnnotations; /// Allow breaking string literals when formatting. + /// + /// In C, C++, and Objective-C: /// \code /// true: /// const char* x = "veryVeryVeryVeryVeryVe" @@ -1845,8 +2296,35 @@ struct FormatStyle { /// /// false: /// const char* x = - /// "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; + /// "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; + /// \endcode + /// + /// In C# and Java: + /// \code + /// true: + /// string x = "veryVeryVeryVeryVeryVe" + + /// "ryVeryVeryVeryVeryVery" + + /// "VeryLongString"; + /// + /// false: + /// string x = + /// "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; /// \endcode + /// + /// C# interpolated strings are not broken. + /// + /// In Verilog: + /// \code + /// true: + /// string x = {"veryVeryVeryVeryVeryVe", + /// "ryVeryVeryVeryVeryVery", + /// "VeryLongString"}; + /// + /// false: + /// string x = + /// "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; + /// \endcode + /// /// \version 3.9 bool BreakStringLiterals; @@ -1908,6 +2386,10 @@ struct FormatStyle { /// \version 7 BreakInheritanceListStyle BreakInheritanceList; + /// The template declaration breaking style to use. + /// \version 19 + BreakTemplateDeclarationsStyle BreakTemplateDeclarations; + /// If ``true``, consecutive namespace declarations will be on the same /// line. If ``false``, each namespace is declared on a new line. /// \code @@ -1976,10 +2458,10 @@ struct FormatStyle { /// \version 3.4 bool Cpp11BracedListStyle; - /// \brief Analyze the formatted file for the most used line ending (``\r\n`` - /// or ``\n``). ``UseCRLF`` is only used as a fallback if none can be derived. + /// This option is **deprecated**. See ``DeriveLF`` and ``DeriveCRLF`` of + /// ``LineEnding``. /// \version 10 - bool DeriveLineEnding; + // bool DeriveLineEnding; /// If ``true``, analyze the formatted file for the most common /// alignment of ``&`` and ``*``. @@ -2115,8 +2597,10 @@ struct FormatStyle { /// made, clang-format analyzes whether there are other bin-packed cases in /// the input file and act accordingly. /// - /// NOTE: This is an experimental flag, that might go away or be renamed. Do - /// not use this in config files, etc. Use at your own risk. + /// \note + /// This is an experimental flag, that might go away or be renamed. Do + /// not use this in config files, etc. Use at your own risk. + /// \endnote /// \version 3.7 bool ExperimentalAutoDetectBinPacking; @@ -2147,7 +2631,7 @@ struct FormatStyle { /// /// In the .clang-format configuration file, this can be configured like: /// \code{.yaml} - /// ForEachMacros: ['RANGES_FOR', 'FOREACH'] + /// ForEachMacros: [RANGES_FOR, FOREACH] /// \endcode /// /// For example: BOOST_FOREACH. @@ -2169,7 +2653,7 @@ struct FormatStyle { /// /// In the .clang-format configuration file, this can be configured like: /// \code{.yaml} - /// IfMacros: ['IF'] + /// IfMacros: [IF] /// \endcode /// /// For example: `KJ_IF_MAYBE @@ -2392,9 +2876,9 @@ struct FormatStyle { /// and ``while``) in C++ unless the control statements are inside macro /// definitions or the braces would enclose preprocessor directives. /// \warning - /// Setting this option to `true` could lead to incorrect code formatting due - /// to clang-format's lack of complete semantic information. As such, extra - /// care should be taken to review code changes made by this option. + /// Setting this option to ``true`` could lead to incorrect code formatting + /// due to clang-format's lack of complete semantic information. As such, + /// extra care should be taken to review code changes made by this option. /// \endwarning /// \code /// false: true: @@ -2420,6 +2904,10 @@ struct FormatStyle { /// \version 15 bool InsertBraces; + /// Insert a newline at end of file if missing. + /// \version 16 + bool InsertNewlineAtEOF; + /// The style of inserting trailing commas into container literals. enum TrailingCommaStyle : int8_t { /// Do not insert trailing commas. @@ -2451,29 +2939,77 @@ struct FormatStyle { TrailingCommaStyle InsertTrailingCommas; /// Separator format of integer literals of different bases. - /// If <0: Remove separators. - /// If 0: Leave the literal as is. - /// If >0: Insert separators between digits starting from the rightmost digit. + /// + /// If negative, remove separators. If ``0``, leave the literal as is. If + /// positive, insert separators between digits starting from the rightmost + /// digit. + /// + /// For example, the config below will leave separators in binary literals + /// alone, insert separators in decimal literals to separate the digits into + /// groups of 3, and remove separators in hexadecimal literals. + /// \code + /// IntegerLiteralSeparator: + /// Binary: 0 + /// Decimal: 3 + /// Hex: -1 + /// \endcode + /// + /// You can also specify a minimum number of digits (``BinaryMinDigits``, + /// ``DecimalMinDigits``, and ``HexMinDigits``) the integer literal must + /// have in order for the separators to be inserted. struct IntegerLiteralSeparatorStyle { - /// \code - /// -1: 0b100111101101 - /// 0: 0b10011'11'0110'1 - /// 3: 0b100'111'101'101 - /// 4: 0b1001'1110'1101 + /// Format separators in binary literals. + /// \code{.text} + /// /* -1: */ b = 0b100111101101; + /// /* 0: */ b = 0b10011'11'0110'1; + /// /* 3: */ b = 0b100'111'101'101; + /// /* 4: */ b = 0b1001'1110'1101; /// \endcode int8_t Binary; - /// \code - /// -1: 18446744073709550592ull - /// 0: 184467'440737'0'95505'92ull - /// 3: 18'446'744'073'709'550'592ull + /// Format separators in binary literals with a minimum number of digits. + /// \code{.text} + /// // Binary: 3 + /// // BinaryMinDigits: 7 + /// b1 = 0b101101; + /// b2 = 0b1'101'101; + /// \endcode + int8_t BinaryMinDigits; + /// Format separators in decimal literals. + /// \code{.text} + /// /* -1: */ d = 18446744073709550592ull; + /// /* 0: */ d = 184467'440737'0'95505'92ull; + /// /* 3: */ d = 18'446'744'073'709'550'592ull; /// \endcode int8_t Decimal; - /// \code - /// -1: 0xDEADBEEFDEADBEEFuz - /// 0: 0xDEAD'BEEF'DE'AD'BEE'Fuz - /// 2: 0xDE'AD'BE'EF'DE'AD'BE'EFuz + /// Format separators in decimal literals with a minimum number of digits. + /// \code{.text} + /// // Decimal: 3 + /// // DecimalMinDigits: 5 + /// d1 = 2023; + /// d2 = 10'000; + /// \endcode + int8_t DecimalMinDigits; + /// Format separators in hexadecimal literals. + /// \code{.text} + /// /* -1: */ h = 0xDEADBEEFDEADBEEFuz; + /// /* 0: */ h = 0xDEAD'BEEF'DE'AD'BEE'Fuz; + /// /* 2: */ h = 0xDE'AD'BE'EF'DE'AD'BE'EFuz; /// \endcode int8_t Hex; + /// Format separators in hexadecimal literals with a minimum number of + /// digits. + /// \code{.text} + /// // Hex: 2 + /// // HexMinDigits: 6 + /// h1 = 0xABCDE; + /// h2 = 0xAB'CD'EF; + /// \endcode + int8_t HexMinDigits; + bool operator==(const IntegerLiteralSeparatorStyle &R) const { + return Binary == R.Binary && BinaryMinDigits == R.BinaryMinDigits && + Decimal == R.Decimal && DecimalMinDigits == R.DecimalMinDigits && + Hex == R.Hex && HexMinDigits == R.HexMinDigits; + } }; /// Format integer literal separators (``'`` for C++ and ``_`` for C#, Java, @@ -2494,7 +3030,7 @@ struct FormatStyle { /// in the following yaml example. This will result in imports being /// formatted as in the Java example below. /// \code{.yaml} - /// JavaImportGroups: ['com.example', 'com', 'org'] + /// JavaImportGroups: [com.example, com, org] /// \endcode /// /// \code{.java} @@ -2550,7 +3086,7 @@ struct FormatStyle { /// VeryLongImportsAreAnnoying, /// VeryLongImportsAreAnnoying, /// VeryLongImportsAreAnnoying, - /// } from 'some/module.js' + /// } from "some/module.js" /// /// false: /// import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js" @@ -2559,16 +3095,49 @@ struct FormatStyle { bool JavaScriptWrapImports; // clang-format on - /// If true, the empty line at the start of blocks is kept. + /// Options regarding which empty lines are kept. + /// + /// For example, the config below will remove empty lines at start of the + /// file, end of the file, and start of blocks. + /// /// \code - /// true: false: - /// if (foo) { vs. if (foo) { - /// bar(); - /// bar(); } - /// } + /// KeepEmptyLines: + /// AtEndOfFile: false + /// AtStartOfBlock: false + /// AtStartOfFile: false /// \endcode + struct KeepEmptyLinesStyle { + /// Keep empty lines at end of file. + bool AtEndOfFile; + /// Keep empty lines at start of a block. + /// \code + /// true: false: + /// if (foo) { vs. if (foo) { + /// bar(); + /// bar(); } + /// } + /// \endcode + bool AtStartOfBlock; + /// Keep empty lines at start of file. + bool AtStartOfFile; + bool operator==(const KeepEmptyLinesStyle &R) const { + return AtEndOfFile == R.AtEndOfFile && + AtStartOfBlock == R.AtStartOfBlock && + AtStartOfFile == R.AtStartOfFile; + } + }; + /// Which empty lines are kept. See ``MaxEmptyLinesToKeep`` for how many + /// consecutive empty lines are kept. + /// \version 19 + KeepEmptyLinesStyle KeepEmptyLines; + + /// This option is deprecated. See ``AtEndOfFile`` of ``KeepEmptyLines``. + /// \version 17 + // bool KeepEmptyLinesAtEOF; + + /// This option is deprecated. See ``AtStartOfBlock`` of ``KeepEmptyLines``. /// \version 3.7 - bool KeepEmptyLinesAtTheStartOfBlocks; + // bool KeepEmptyLinesAtTheStartOfBlocks; /// Indentation logic for lambda bodies. enum LambdaBodyIndentationKind : int8_t { @@ -2580,13 +3149,18 @@ struct FormatStyle { /// }); /// \endcode LBI_Signature, - /// Align lambda body relative to the indentation level of the outer scope - /// the lambda signature resides in. + /// For statements within block scope, align lambda body relative to the + /// indentation level of the outer scope the lambda signature resides in. /// \code /// someMethod( /// [](SomeReallyLongLambdaSignatureArgument foo) { /// return; /// }); + /// + /// someMethod(someOtherMethod( + /// [](SomeReallyLongLambdaSignatureArgument foo) { + /// return; + /// })); /// \endcode LBI_OuterScope, }; @@ -2595,11 +3169,7 @@ struct FormatStyle { /// causes the lambda body to be indented one additional level relative to /// the indentation level of the signature. ``OuterScope`` forces the lambda /// body to be indented one additional level relative to the parent scope - /// containing the lambda signature. For callback-heavy code, it may improve - /// readability to have the signature indented two levels and to use - /// ``OuterScope``. The KJ style guide requires ``OuterScope``. - /// `KJ style guide - /// `_ + /// containing the lambda signature. /// \version 13 LambdaBodyIndentationKind LambdaBodyIndentation; @@ -2641,12 +3211,31 @@ struct FormatStyle { bool isJson() const { return Language == LK_Json; } bool isJavaScript() const { return Language == LK_JavaScript; } bool isVerilog() const { return Language == LK_Verilog; } - bool isProto() const { return Language == LK_Proto; } + bool isProto() const { + return Language == LK_Proto || Language == LK_TextProto; + } + bool isTableGen() const { return Language == LK_TableGen; } /// Language, this format style is targeted at. /// \version 3.5 LanguageKind Language; + /// Line ending style. + enum LineEndingStyle : int8_t { + /// Use ``\n``. + LE_LF, + /// Use ``\r\n``. + LE_CRLF, + /// Use ``\n`` unless the input has more lines ending in ``\r\n``. + LE_DeriveLF, + /// Use ``\r\n`` unless the input has more lines ending in ``\n``. + LE_DeriveCRLF, + }; + + /// Line ending style (``\n`` or ``\r\n``) to use. + /// \version 16 + LineEndingStyle LineEnding; + /// A regular expression matching macros that start a block. /// \code /// # With: @@ -2680,6 +3269,46 @@ struct FormatStyle { /// \version 3.7 std::string MacroBlockEnd; + /// A list of macros of the form \c = . + /// + /// Code will be parsed with macros expanded, in order to determine how to + /// interpret and format the macro arguments. + /// + /// For example, the code: + /// \code + /// A(a*b); + /// \endcode + /// + /// will usually be interpreted as a call to a function A, and the + /// multiplication expression will be formatted as ``a * b``. + /// + /// If we specify the macro definition: + /// \code{.yaml} + /// Macros: + /// - A(x)=x + /// \endcode + /// + /// the code will now be parsed as a declaration of the variable b of type a*, + /// and formatted as ``a* b`` (depending on pointer-binding rules). + /// + /// Features and restrictions: + /// * Both function-like macros and object-like macros are supported. + /// * Macro arguments must be used exactly once in the expansion. + /// * No recursive expansion; macros referencing other macros will be + /// ignored. + /// * Overloading by arity is supported: for example, given the macro + /// definitions A=x, A()=y, A(a)=a + /// + /// \code + /// A; -> x; + /// A(); -> y; + /// A(z); -> z; + /// A(a, b); // will not be expanded. + /// \endcode + /// + /// \version 17 + std::vector Macros; + /// The maximum number of consecutive empty lines to keep. /// \code /// MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0 @@ -2813,6 +3442,29 @@ struct FormatStyle { /// \version 11 bool ObjCBreakBeforeNestedBlockParam; + /// The order in which ObjC property attributes should appear. + /// + /// Attributes in code will be sorted in the order specified. Any attributes + /// encountered that are not mentioned in this array will be sorted last, in + /// stable order. Comments between attributes will leave the attributes + /// untouched. + /// \warning + /// Using this option could lead to incorrect code formatting due to + /// clang-format's lack of complete semantic information. As such, extra + /// care should be taken to review code changes made by this option. + /// \endwarning + /// \code{.yaml} + /// ObjCPropertyAttributeOrder: [ + /// class, direct, + /// atomic, nonatomic, + /// assign, retain, strong, copy, weak, unsafe_unretained, + /// readonly, readwrite, getter, setter, + /// nullable, nonnull, null_resettable, null_unspecified + /// ] + /// \endcode + /// \version 18 + std::vector ObjCPropertyAttributeOrder; + /// Add a space after ``@property`` in Objective-C, i.e. use /// ``@property (readonly)`` instead of ``@property(readonly)``. /// \version 3.7 @@ -2864,10 +3516,25 @@ struct FormatStyle { /// cccccccccccccccccccc() /// \endcode PCIS_NextLine, + /// Put all constructor initializers on the next line if they fit. + /// Otherwise, put each one on its own line. + /// \code + /// Constructor() + /// : a(), b() + /// + /// Constructor() + /// : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd() + /// + /// Constructor() + /// : aaaaaaaaaaaaaaaaaaaa(), + /// bbbbbbbbbbbbbbbbbbbb(), + /// cccccccccccccccccccc() + /// \endcode + PCIS_NextLineOnly, }; /// The pack constructor initializers style to use. - /// \version 14; + /// \version 14 PackConstructorInitializersStyle PackConstructorInitializers; /// The penalty for breaking around an assignment operator. @@ -2890,6 +3557,10 @@ struct FormatStyle { /// \version 14 unsigned PenaltyBreakOpenParenthesis; + /// The penalty for breaking after ``::``. + /// \version 18 + unsigned PenaltyBreakScopeResolution; + /// The penalty for each line break introduced inside a string literal. /// \version 3.7 unsigned PenaltyBreakString; @@ -2973,7 +3644,7 @@ struct FormatStyle { /// Change specifiers/qualifiers to be aligned based on ``QualifierOrder``. /// With: /// \code{.yaml} - /// QualifierOrder: ['inline', 'static', 'type', 'const'] + /// QualifierOrder: [inline, static, type, const] /// \endcode /// /// \code @@ -2986,7 +3657,7 @@ struct FormatStyle { /// Different ways to arrange specifiers and qualifiers (e.g. const/volatile). /// \warning - /// Setting ``QualifierAlignment`` to something other than `Leave`, COULD + /// Setting ``QualifierAlignment`` to something other than ``Leave``, COULD /// lead to incorrect code formatting due to incorrect decisions made due to /// clang-formats lack of complete semantic information. /// As such extra care should be taken to review code changes made by the use @@ -3007,13 +3678,16 @@ struct FormatStyle { /// * restrict /// * type /// - /// Note: it MUST contain 'type'. - /// Items to the left of 'type' will be placed to the left of the type and - /// aligned in the order supplied. Items to the right of 'type' will be placed - /// to the right of the type and aligned in the order supplied. + /// \note + /// It **must** contain ``type``. + /// \endnote + /// + /// Items to the left of ``type`` will be placed to the left of the type and + /// aligned in the order supplied. Items to the right of ``type`` will be + /// placed to the right of the type and aligned in the order supplied. /// /// \code{.yaml} - /// QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ] + /// QualifierOrder: [inline, static, type, const, volatile] /// \endcode /// \version 14 std::vector QualifierOrder; @@ -3047,10 +3721,10 @@ struct FormatStyle { /// name will be reformatted assuming the specified language based on the /// style for that language defined in the .clang-format file. If no style has /// been defined in the .clang-format file for the specific language, a - /// predefined style given by 'BasedOnStyle' is used. If 'BasedOnStyle' is not - /// found, the formatting is based on llvm style. A matching delimiter takes - /// precedence over a matching enclosing function name for determining the - /// language of the raw string contents. + /// predefined style given by ``BasedOnStyle`` is used. If ``BasedOnStyle`` is + /// not found, the formatting is based on ``LLVM`` style. A matching delimiter + /// takes precedence over a matching enclosing function name for determining + /// the language of the raw string contents. /// /// If a canonical delimiter is specified, occurrences of other delimiters for /// the same language will be updated to the canonical if possible. @@ -3063,17 +3737,17 @@ struct FormatStyle { /// RawStringFormats: /// - Language: TextProto /// Delimiters: - /// - 'pb' - /// - 'proto' + /// - pb + /// - proto /// EnclosingFunctions: - /// - 'PARSE_TEXT_PROTO' + /// - PARSE_TEXT_PROTO /// BasedOnStyle: google /// - Language: Cpp /// Delimiters: - /// - 'cc' - /// - 'cpp' - /// BasedOnStyle: llvm - /// CanonicalDelimiter: 'cc' + /// - cc + /// - cpp + /// BasedOnStyle: LLVM + /// CanonicalDelimiter: cc /// \endcode /// \version 6 std::vector RawStringFormats; @@ -3129,9 +3803,9 @@ struct FormatStyle { /// This option will be renamed and expanded to support other styles. /// \endwarning /// \warning - /// Setting this option to `true` could lead to incorrect code formatting due - /// to clang-format's lack of complete semantic information. As such, extra - /// care should be taken to review code changes made by this option. + /// Setting this option to ``true`` could lead to incorrect code formatting + /// due to clang-format's lack of complete semantic information. As such, + /// extra care should be taken to review code changes made by this option. /// \endwarning /// \code /// false: true: @@ -3177,11 +3851,48 @@ struct FormatStyle { /// \version 14 bool RemoveBracesLLVM; - /// Remove semicolons after the closing brace of a non-empty function. + /// Types of redundant parentheses to remove. + enum RemoveParenthesesStyle : int8_t { + /// Do not remove parentheses. + /// \code + /// class __declspec((dllimport)) X {}; + /// co_return (((0))); + /// return ((a + b) - ((c + d))); + /// \endcode + RPS_Leave, + /// Replace multiple parentheses with single parentheses. + /// \code + /// class __declspec(dllimport) X {}; + /// co_return (0); + /// return ((a + b) - (c + d)); + /// \endcode + RPS_MultipleParentheses, + /// Also remove parentheses enclosing the expression in a + /// ``return``/``co_return`` statement. + /// \code + /// class __declspec(dllimport) X {}; + /// co_return 0; + /// return (a + b) - (c + d); + /// \endcode + RPS_ReturnStatement, + }; + + /// Remove redundant parentheses. /// \warning - /// Setting this option to `true` could lead to incorrect code formatting due - /// to clang-format's lack of complete semantic information. As such, extra - /// care should be taken to review code changes made by this option. + /// Setting this option to any value other than ``Leave`` could lead to + /// incorrect code formatting due to clang-format's lack of complete semantic + /// information. As such, extra care should be taken to review code changes + /// made by this option. + /// \endwarning + /// \version 17 + RemoveParenthesesStyle RemoveParentheses; + + /// Remove semicolons after the closing braces of functions and + /// constructors/destructors. + /// \warning + /// Setting this option to ``true`` could lead to incorrect code formatting + /// due to clang-format's lack of complete semantic information. As such, + /// extra care should be taken to review code changes made by this option. /// \endwarning /// \code /// false: true: @@ -3287,7 +3998,7 @@ struct FormatStyle { /// } /// \endcode REI_OuterScope, - /// Align requires expression body relative to the `requires` keyword. + /// Align requires expression body relative to the ``requires`` keyword. /// \code /// template /// concept C = requires(T t) { @@ -3364,7 +4075,7 @@ struct FormatStyle { /// /// This determines the maximum length of short namespaces by counting /// unwrapped lines (i.e. containing neither opening nor closing - /// namespace brace) and makes "FixNamespaceComments" omit adding + /// namespace brace) and makes ``FixNamespaceComments`` omit adding /// end comments for those. /// \code /// ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0 @@ -3381,6 +4092,10 @@ struct FormatStyle { /// \version 13 unsigned ShortNamespaceLines; + /// Do not format macro definition body. + /// \version 18 + bool SkipMacroDefinitionBody; + /// Include sorting options. enum SortIncludesOptions : int8_t { /// Includes are never sorted. @@ -3413,11 +4128,6 @@ struct FormatStyle { }; /// Controls if and how clang-format will sort ``#includes``. - /// If ``Never``, includes are never sorted. - /// If ``CaseInsensitive``, includes are sorted in an ASCIIbetical or case - /// insensitive fashion. - /// If ``CaseSensitive``, includes are sorted in an alphabetical or case - /// sensitive fashion. /// \version 3.8 SortIncludesOptions SortIncludes; @@ -3445,22 +4155,49 @@ struct FormatStyle { /// \version 12 SortJavaStaticImportOptions SortJavaStaticImport; - /// If ``true``, clang-format will sort using declarations. - /// - /// The order of using declarations is defined as follows: - /// Split the strings by "::" and discard any initial empty strings. The last - /// element of each list is a non-namespace name; all others are namespace - /// names. Sort the lists of names lexicographically, where the sort order of - /// individual names is that all non-namespace names come before all namespace - /// names, and within those groups, names are in case-insensitive - /// lexicographic order. - /// \code - /// false: true: - /// using std::cout; vs. using std::cin; - /// using std::cin; using std::cout; - /// \endcode + /// Using declaration sorting options. + enum SortUsingDeclarationsOptions : int8_t { + /// Using declarations are never sorted. + /// \code + /// using std::chrono::duration_cast; + /// using std::move; + /// using boost::regex; + /// using boost::regex_constants::icase; + /// using std::string; + /// \endcode + SUD_Never, + /// Using declarations are sorted in the order defined as follows: + /// Split the strings by ``::`` and discard any initial empty strings. Sort + /// the lists of names lexicographically, and within those groups, names are + /// in case-insensitive lexicographic order. + /// \code + /// using boost::regex; + /// using boost::regex_constants::icase; + /// using std::chrono::duration_cast; + /// using std::move; + /// using std::string; + /// \endcode + SUD_Lexicographic, + /// Using declarations are sorted in the order defined as follows: + /// Split the strings by ``::`` and discard any initial empty strings. The + /// last element of each list is a non-namespace name; all others are + /// namespace names. Sort the lists of names lexicographically, where the + /// sort order of individual names is that all non-namespace names come + /// before all namespace names, and within those groups, names are in + /// case-insensitive lexicographic order. + /// \code + /// using boost::regex; + /// using boost::regex_constants::icase; + /// using std::move; + /// using std::string; + /// using std::chrono::duration_cast; + /// \endcode + SUD_LexicographicNumeric, + }; + + /// Controls if and how clang-format will sort using declarations. /// \version 5 - bool SortUsingDeclarations; + SortUsingDeclarationsOptions SortUsingDeclarations; /// If ``true``, a space is inserted after C style casts. /// \code @@ -3478,7 +4215,7 @@ struct FormatStyle { /// \version 9 bool SpaceAfterLogicalNot; - /// If \c true, a space will be inserted after the 'template' keyword. + /// If \c true, a space will be inserted after the ``template`` keyword. /// \code /// true: false: /// template void foo(); vs. template void foo(); @@ -3567,16 +4304,22 @@ struct FormatStyle { /// \version 7 bool SpaceBeforeInheritanceColon; + /// If ``true``, a space will be added before a JSON colon. For other + /// languages, e.g. JavaScript, use ``SpacesInContainerLiterals`` instead. + /// \code + /// true: false: + /// { { + /// "key" : "value" vs. "key": "value" + /// } } + /// \endcode + /// \version 17 + bool SpaceBeforeJsonColon; + /// Different ways to put a space before opening parentheses. enum SpaceBeforeParensStyle : int8_t { - /// Never put a space before opening parentheses. - /// \code - /// void f() { - /// if(true) { - /// f(); - /// } - /// } - /// \endcode + /// This is **deprecated** and replaced by ``Custom`` below, with all + /// ``SpaceBeforeParensOptions`` but ``AfterPlacementOperator`` set to + /// ``false``. SBPO_Never, /// Put a space before opening parentheses only after control statement /// keywords (``for/if/while...``). @@ -3602,7 +4345,7 @@ struct FormatStyle { /// \endcode SBPO_ControlStatementsExceptControlMacros, /// Put a space before opening parentheses only if the parentheses are not - /// empty i.e. '()' + /// empty. /// \code /// void() { /// if (true) { @@ -3625,7 +4368,7 @@ struct FormatStyle { /// \endcode SBPO_Always, /// Configure each individual space before parentheses in - /// `SpaceBeforeParensOptions`. + /// ``SpaceBeforeParensOptions``. SBPO_Custom, }; @@ -3642,7 +4385,7 @@ struct FormatStyle { /// AfterFunctionDefinitionName: true /// \endcode struct SpaceBeforeParensCustom { - /// If ``true``, put space betwee control statement keywords + /// If ``true``, put space between control statement keywords /// (for/if/while...) and opening parentheses. /// \code /// true: false: @@ -3685,6 +4428,14 @@ struct FormatStyle { /// object.operator++ (10); object.operator++(10); /// \endcode bool AfterOverloadedOperator; + /// If ``true``, put a space between operator ``new``/``delete`` and opening + /// parenthesis. + /// \code + /// true: false: + /// new (buf) T; vs. new(buf) T; + /// delete (buf) T; delete(buf) T; + /// \endcode + bool AfterPlacementOperator; /// If ``true``, put space between requires keyword in a requires clause and /// opening parentheses, if there is one. /// \code @@ -3717,8 +4468,9 @@ struct FormatStyle { : AfterControlStatements(false), AfterForeachMacros(false), AfterFunctionDeclarationName(false), AfterFunctionDefinitionName(false), AfterIfMacros(false), - AfterOverloadedOperator(false), AfterRequiresInClause(false), - AfterRequiresInExpression(false), BeforeNonEmptyParentheses(false) {} + AfterOverloadedOperator(false), AfterPlacementOperator(true), + AfterRequiresInClause(false), AfterRequiresInExpression(false), + BeforeNonEmptyParentheses(false) {} bool operator==(const SpaceBeforeParensCustom &Other) const { return AfterControlStatements == Other.AfterControlStatements && @@ -3728,6 +4480,7 @@ struct FormatStyle { AfterFunctionDefinitionName == Other.AfterFunctionDefinitionName && AfterIfMacros == Other.AfterIfMacros && AfterOverloadedOperator == Other.AfterOverloadedOperator && + AfterPlacementOperator == Other.AfterPlacementOperator && AfterRequiresInClause == Other.AfterRequiresInClause && AfterRequiresInExpression == Other.AfterRequiresInExpression && BeforeNonEmptyParentheses == Other.BeforeNonEmptyParentheses; @@ -3778,24 +4531,20 @@ struct FormatStyle { bool SpaceInEmptyBlock; /// If ``true``, spaces may be inserted into ``()``. - /// \code - /// true: false: - /// void f( ) { vs. void f() { - /// int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()}; - /// if (true) { if (true) { - /// f( ); f(); - /// } } - /// } } - /// \endcode + /// This option is **deprecated**. See ``InEmptyParentheses`` of + /// ``SpacesInParensOptions``. /// \version 3.7 - bool SpaceInEmptyParentheses; + // bool SpaceInEmptyParentheses; /// The number of spaces before trailing line comments /// (``//`` - comments). /// - /// This does not affect trailing block comments (``/*`` - comments) as - /// those commonly have different usage patterns and a number of special - /// cases. + /// This does not affect trailing block comments (``/*`` - comments) as those + /// commonly have different usage patterns and a number of special cases. In + /// the case of Verilog, it doesn't affect a comment right after the opening + /// parenthesis in the port or parameter list in a module header, because it + /// is probably for the port on the following line instead of the parenthesis + /// it follows. /// \code /// SpacesBeforeTrailingComments: 3 /// void f() { @@ -3807,7 +4556,7 @@ struct FormatStyle { /// \version 3.7 unsigned SpacesBeforeTrailingComments; - /// Styles for adding spacing after ``<`` and before ``>` + /// Styles for adding spacing after ``<`` and before ``>`` /// in template argument lists. enum SpacesInAnglesStyle : int8_t { /// Remove spaces after ``<`` and before ``>``. @@ -3832,16 +4581,14 @@ struct FormatStyle { /// If ``true``, spaces will be inserted around if/for/switch/while /// conditions. - /// \code - /// true: false: - /// if ( a ) { ... } vs. if (a) { ... } - /// while ( i < 5 ) { ... } while (i < 5) { ... } - /// \endcode + /// This option is **deprecated**. See ``InConditionalStatements`` of + /// ``SpacesInParensOptions``. /// \version 10 - bool SpacesInConditionalStatement; + // bool SpacesInConditionalStatement; - /// If ``true``, spaces are inserted inside container literals (e.g. - /// ObjC and Javascript array and dict literals). + /// If ``true``, spaces are inserted inside container literals (e.g. ObjC and + /// Javascript array and dict literals). For JSON, use + /// ``SpaceBeforeJsonColon`` instead. /// \code{.js} /// true: false: /// var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3]; @@ -3851,12 +4598,10 @@ struct FormatStyle { bool SpacesInContainerLiterals; /// If ``true``, spaces may be inserted into C style casts. - /// \code - /// true: false: - /// x = ( int32 )y vs. x = (int32)y - /// \endcode + /// This option is **deprecated**. See ``InCStyleCasts`` of + /// ``SpacesInParensOptions``. /// \version 3.7 - bool SpacesInCStyleCastParentheses; + // bool SpacesInCStyleCastParentheses; /// Control of spaces within a single line comment. struct SpacesInLineComment { @@ -3900,13 +4645,127 @@ struct FormatStyle { /// \version 13 SpacesInLineComment SpacesInLineCommentPrefix; + /// Different ways to put a space before opening and closing parentheses. + enum SpacesInParensStyle : int8_t { + /// Never put a space in parentheses. + /// \code + /// void f() { + /// if(true) { + /// f(); + /// } + /// } + /// \endcode + SIPO_Never, + /// Configure each individual space in parentheses in + /// `SpacesInParensOptions`. + SIPO_Custom, + }; + /// If ``true``, spaces will be inserted after ``(`` and before ``)``. + /// This option is **deprecated**. The previous behavior is preserved by using + /// ``SpacesInParens`` with ``Custom`` and by setting all + /// ``SpacesInParensOptions`` to ``true`` except for ``InCStyleCasts`` and + /// ``InEmptyParentheses``. + /// \version 3.7 + // bool SpacesInParentheses; + + /// Defines in which cases spaces will be inserted after ``(`` and before + /// ``)``. + /// \version 17 + SpacesInParensStyle SpacesInParens; + + /// Precise control over the spacing in parentheses. /// \code - /// true: false: - /// t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete; + /// # Should be declared this way: + /// SpacesInParens: Custom + /// SpacesInParensOptions: + /// ExceptDoubleParentheses: false + /// InConditionalStatements: true + /// Other: true /// \endcode - /// \version 3.7 - bool SpacesInParentheses; + struct SpacesInParensCustom { + /// Override any of the following options to prevent addition of space + /// when both opening and closing parentheses use multiple parentheses. + /// \code + /// true: + /// __attribute__(( noreturn )) + /// __decltype__(( x )) + /// if (( a = b )) + /// \endcode + /// false: + /// Uses the applicable option. + bool ExceptDoubleParentheses; + /// Put a space in parentheses only inside conditional statements + /// (``for/if/while/switch...``). + /// \code + /// true: false: + /// if ( a ) { ... } vs. if (a) { ... } + /// while ( i < 5 ) { ... } while (i < 5) { ... } + /// \endcode + bool InConditionalStatements; + /// Put a space in C style casts. + /// \code + /// true: false: + /// x = ( int32 )y vs. x = (int32)y + /// y = (( int (*)(int) )foo)(x); y = ((int (*)(int))foo)(x); + /// \endcode + bool InCStyleCasts; + /// Insert a space in empty parentheses, i.e. ``()``. + /// \code + /// true: false: + /// void f( ) { vs. void f() { + /// int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()}; + /// if (true) { if (true) { + /// f( ); f(); + /// } } + /// } } + /// \endcode + bool InEmptyParentheses; + /// Put a space in parentheses not covered by preceding options. + /// \code + /// true: false: + /// t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete; + /// \endcode + bool Other; + + SpacesInParensCustom() + : ExceptDoubleParentheses(false), InConditionalStatements(false), + InCStyleCasts(false), InEmptyParentheses(false), Other(false) {} + + SpacesInParensCustom(bool ExceptDoubleParentheses, + bool InConditionalStatements, bool InCStyleCasts, + bool InEmptyParentheses, bool Other) + : ExceptDoubleParentheses(ExceptDoubleParentheses), + InConditionalStatements(InConditionalStatements), + InCStyleCasts(InCStyleCasts), InEmptyParentheses(InEmptyParentheses), + Other(Other) {} + + bool operator==(const SpacesInParensCustom &R) const { + return ExceptDoubleParentheses == R.ExceptDoubleParentheses && + InConditionalStatements == R.InConditionalStatements && + InCStyleCasts == R.InCStyleCasts && + InEmptyParentheses == R.InEmptyParentheses && Other == R.Other; + } + bool operator!=(const SpacesInParensCustom &R) const { + return !(*this == R); + } + }; + + /// Control of individual spaces in parentheses. + /// + /// If ``SpacesInParens`` is set to ``Custom``, use this to specify + /// how each individual space in parentheses case should be handled. + /// Otherwise, this is ignored. + /// \code{.yaml} + /// # Example of usage: + /// SpacesInParens: Custom + /// SpacesInParensOptions: + /// ExceptDoubleParentheses: false + /// InConditionalStatements: true + /// InEmptyParentheses: true + /// \endcode + /// \version 17 + SpacesInParensCustom SpacesInParensOptions; /// If ``true``, spaces will be inserted after ``[`` and before ``]``. /// Lambdas without arguments or unspecified size array declarations will not @@ -3982,10 +4841,74 @@ struct FormatStyle { /// \version 8 std::vector StatementMacros; + /// Works only when TableGenBreakInsideDAGArg is not DontBreak. + /// The string list needs to consist of identifiers in TableGen. + /// If any identifier is specified, this limits the line breaks by + /// TableGenBreakInsideDAGArg option only on DAGArg values beginning with + /// the specified identifiers. + /// + /// For example the configuration, + /// \code{.yaml} + /// TableGenBreakInsideDAGArg: BreakAll + /// TableGenBreakingDAGArgOperators: [ins, outs] + /// \endcode + /// + /// makes the line break only occurs inside DAGArgs beginning with the + /// specified identifiers ``ins`` and ``outs``. + /// + /// \code + /// let DAGArgIns = (ins + /// i32:$src1, + /// i32:$src2 + /// ); + /// let DAGArgOtherID = (other i32:$other1, i32:$other2); + /// let DAGArgBang = (!cast("Some") i32:$src1, i32:$src2) + /// \endcode + /// \version 19 + std::vector TableGenBreakingDAGArgOperators; + + /// Different ways to control the format inside TableGen DAGArg. + enum DAGArgStyle : int8_t { + /// Never break inside DAGArg. + /// \code + /// let DAGArgIns = (ins i32:$src1, i32:$src2); + /// \endcode + DAS_DontBreak, + /// Break inside DAGArg after each list element but for the last. + /// This aligns to the first element. + /// \code + /// let DAGArgIns = (ins i32:$src1, + /// i32:$src2); + /// \endcode + DAS_BreakElements, + /// Break inside DAGArg after the operator and the all elements. + /// \code + /// let DAGArgIns = (ins + /// i32:$src1, + /// i32:$src2 + /// ); + /// \endcode + DAS_BreakAll, + }; + + /// The styles of the line break inside the DAGArg in TableGen. + /// \version 19 + DAGArgStyle TableGenBreakInsideDAGArg; + /// The number of columns used for tab stops. /// \version 3.7 unsigned TabWidth; + /// A vector of non-keyword identifiers that should be interpreted as type + /// names. + /// + /// A ``*``, ``&``, or ``&&`` between a type name and another non-keyword + /// identifier is annotated as a pointer or reference token instead of a + /// binary operator. + /// + /// \version 17 + std::vector TypeNames; + /// \brief A vector of macros that should be interpreted as type declarations /// instead of as function calls. /// @@ -3996,17 +4919,16 @@ struct FormatStyle { /// /// In the .clang-format configuration file, this can be configured like: /// \code{.yaml} - /// TypenameMacros: ['STACK_OF', 'LIST'] + /// TypenameMacros: [STACK_OF, LIST] /// \endcode /// /// For example: OpenSSL STACK_OF, BSD LIST_ENTRY. /// \version 9 std::vector TypenameMacros; - /// \brief Use ``\r\n`` instead of ``\n`` for line breaks. - /// Also used as fallback if ``DeriveLineEnding`` is true. + /// This option is **deprecated**. See ``LF`` and ``CRLF`` of ``LineEnding``. /// \version 10 - bool UseCRLF; + // bool UseCRLF; /// Different ways to use tab in formatting. enum UseTabStyle : int8_t { @@ -4029,6 +4951,20 @@ struct FormatStyle { /// \version 3.7 UseTabStyle UseTab; + /// For Verilog, put each port on its own line in module instantiations. + /// \code + /// true: + /// ffnand ff1(.q(), + /// .qbar(out1), + /// .clear(in1), + /// .preset(in2)); + /// + /// false: + /// ffnand ff1(.q(), .qbar(out1), .clear(in1), .preset(in2)); + /// \endcode + /// \version 17 + bool VerilogBreakBetweenInstancePorts; + /// A vector of macros which are whitespace-sensitive and should not /// be touched. /// @@ -4039,7 +4975,7 @@ struct FormatStyle { /// /// In the .clang-format configuration file, this can be configured like: /// \code{.yaml} - /// WhitespaceSensitiveMacros: ['STRINGIZE', 'PP_STRINGIZE'] + /// WhitespaceSensitiveMacros: [STRINGIZE, PP_STRINGIZE] /// \endcode /// /// For example: BOOST_PP_STRINGIZE @@ -4054,15 +4990,29 @@ struct FormatStyle { AlignConsecutiveBitFields == R.AlignConsecutiveBitFields && AlignConsecutiveDeclarations == R.AlignConsecutiveDeclarations && AlignConsecutiveMacros == R.AlignConsecutiveMacros && + AlignConsecutiveShortCaseStatements == + R.AlignConsecutiveShortCaseStatements && + AlignConsecutiveTableGenBreakingDAGArgColons == + R.AlignConsecutiveTableGenBreakingDAGArgColons && + AlignConsecutiveTableGenCondOperatorColons == + R.AlignConsecutiveTableGenCondOperatorColons && + AlignConsecutiveTableGenDefinitionColons == + R.AlignConsecutiveTableGenDefinitionColons && AlignEscapedNewlines == R.AlignEscapedNewlines && AlignOperands == R.AlignOperands && AlignTrailingComments == R.AlignTrailingComments && AllowAllArgumentsOnNextLine == R.AllowAllArgumentsOnNextLine && AllowAllParametersOfDeclarationOnNextLine == R.AllowAllParametersOfDeclarationOnNextLine && + AllowBreakBeforeNoexceptSpecifier == + R.AllowBreakBeforeNoexceptSpecifier && AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine && + AllowShortCaseExpressionOnASingleLine == + R.AllowShortCaseExpressionOnASingleLine && AllowShortCaseLabelsOnASingleLine == R.AllowShortCaseLabelsOnASingleLine && + AllowShortCompoundRequirementOnASingleLine == + R.AllowShortCompoundRequirementOnASingleLine && AllowShortEnumsOnASingleLine == R.AllowShortEnumsOnASingleLine && AllowShortFunctionsOnASingleLine == R.AllowShortFunctionsOnASingleLine && @@ -4070,16 +5020,17 @@ struct FormatStyle { R.AllowShortIfStatementsOnASingleLine && AllowShortLambdasOnASingleLine == R.AllowShortLambdasOnASingleLine && AllowShortLoopsOnASingleLine == R.AllowShortLoopsOnASingleLine && - AlwaysBreakAfterReturnType == R.AlwaysBreakAfterReturnType && AlwaysBreakBeforeMultilineStrings == R.AlwaysBreakBeforeMultilineStrings && - AlwaysBreakTemplateDeclarations == - R.AlwaysBreakTemplateDeclarations && AttributeMacros == R.AttributeMacros && BinPackArguments == R.BinPackArguments && BinPackParameters == R.BinPackParameters && BitFieldColonSpacing == R.BitFieldColonSpacing && + BracedInitializerIndentWidth == R.BracedInitializerIndentWidth && + BreakAdjacentStringLiterals == R.BreakAdjacentStringLiterals && + BreakAfterAttributes == R.BreakAfterAttributes && BreakAfterJavaFieldAnnotations == R.BreakAfterJavaFieldAnnotations && + BreakAfterReturnType == R.BreakAfterReturnType && BreakArrays == R.BreakArrays && BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators && BreakBeforeBraces == R.BreakBeforeBraces && @@ -4087,15 +5038,17 @@ struct FormatStyle { BreakBeforeInlineASMColon == R.BreakBeforeInlineASMColon && BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators && BreakConstructorInitializers == R.BreakConstructorInitializers && + BreakFunctionDefinitionParameters == + R.BreakFunctionDefinitionParameters && BreakInheritanceList == R.BreakInheritanceList && BreakStringLiterals == R.BreakStringLiterals && + BreakTemplateDeclarations == R.BreakTemplateDeclarations && ColumnLimit == R.ColumnLimit && CommentPragmas == R.CommentPragmas && CompactNamespaces == R.CompactNamespaces && ConstructorInitializerIndentWidth == R.ConstructorInitializerIndentWidth && ContinuationIndentWidth == R.ContinuationIndentWidth && Cpp11BracedListStyle == R.Cpp11BracedListStyle && - DeriveLineEnding == R.DeriveLineEnding && DerivePointerAlignment == R.DerivePointerAlignment && DisableFormat == R.DisableFormat && EmptyLineAfterAccessModifier == R.EmptyLineAfterAccessModifier && @@ -4110,6 +5063,7 @@ struct FormatStyle { R.IncludeStyle.IncludeIsMainRegex && IncludeStyle.IncludeIsMainSourceRegex == R.IncludeStyle.IncludeIsMainSourceRegex && + IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar && IndentAccessModifiers == R.IndentAccessModifiers && IndentCaseBlocks == R.IndentCaseBlocks && IndentCaseLabels == R.IndentCaseLabels && @@ -4120,19 +5074,15 @@ struct FormatStyle { IndentWidth == R.IndentWidth && IndentWrappedFunctionNames == R.IndentWrappedFunctionNames && InsertBraces == R.InsertBraces && - IntegerLiteralSeparator.Binary == R.IntegerLiteralSeparator.Binary && - IntegerLiteralSeparator.Decimal == - R.IntegerLiteralSeparator.Decimal && - IntegerLiteralSeparator.Hex == R.IntegerLiteralSeparator.Hex && + InsertNewlineAtEOF == R.InsertNewlineAtEOF && + IntegerLiteralSeparator == R.IntegerLiteralSeparator && JavaImportGroups == R.JavaImportGroups && JavaScriptQuotes == R.JavaScriptQuotes && JavaScriptWrapImports == R.JavaScriptWrapImports && - KeepEmptyLinesAtTheStartOfBlocks == - R.KeepEmptyLinesAtTheStartOfBlocks && - Language == R.Language && + KeepEmptyLines == R.KeepEmptyLines && Language == R.Language && LambdaBodyIndentation == R.LambdaBodyIndentation && - MacroBlockBegin == R.MacroBlockBegin && - MacroBlockEnd == R.MacroBlockEnd && + LineEnding == R.LineEnding && MacroBlockBegin == R.MacroBlockBegin && + MacroBlockEnd == R.MacroBlockEnd && Macros == R.Macros && MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep && NamespaceIndentation == R.NamespaceIndentation && NamespaceMacros == R.NamespaceMacros && @@ -4140,6 +5090,7 @@ struct FormatStyle { ObjCBlockIndentWidth == R.ObjCBlockIndentWidth && ObjCBreakBeforeNestedBlockParam == R.ObjCBreakBeforeNestedBlockParam && + ObjCPropertyAttributeOrder == R.ObjCPropertyAttributeOrder && ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty && ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList && PackConstructorInitializers == R.PackConstructorInitializers && @@ -4149,6 +5100,7 @@ struct FormatStyle { PenaltyBreakComment == R.PenaltyBreakComment && PenaltyBreakFirstLessLess == R.PenaltyBreakFirstLessLess && PenaltyBreakOpenParenthesis == R.PenaltyBreakOpenParenthesis && + PenaltyBreakScopeResolution == R.PenaltyBreakScopeResolution && PenaltyBreakString == R.PenaltyBreakString && PenaltyBreakTemplateDeclaration == R.PenaltyBreakTemplateDeclaration && @@ -4160,11 +5112,13 @@ struct FormatStyle { RawStringFormats == R.RawStringFormats && ReferenceAlignment == R.ReferenceAlignment && RemoveBracesLLVM == R.RemoveBracesLLVM && + RemoveParentheses == R.RemoveParentheses && RemoveSemicolon == R.RemoveSemicolon && RequiresClausePosition == R.RequiresClausePosition && RequiresExpressionIndentation == R.RequiresExpressionIndentation && SeparateDefinitionBlocks == R.SeparateDefinitionBlocks && ShortNamespaceLines == R.ShortNamespaceLines && + SkipMacroDefinitionBody == R.SkipMacroDefinitionBody && SortIncludes == R.SortIncludes && SortJavaStaticImport == R.SortJavaStaticImport && SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && @@ -4176,6 +5130,7 @@ struct FormatStyle { SpaceBeforeCtorInitializerColon == R.SpaceBeforeCtorInitializerColon && SpaceBeforeInheritanceColon == R.SpaceBeforeInheritanceColon && + SpaceBeforeJsonColon == R.SpaceBeforeJsonColon && SpaceBeforeParens == R.SpaceBeforeParens && SpaceBeforeParensOptions == R.SpaceBeforeParensOptions && SpaceAroundPointerQualifiers == R.SpaceAroundPointerQualifiers && @@ -4183,27 +5138,30 @@ struct FormatStyle { R.SpaceBeforeRangeBasedForLoopColon && SpaceBeforeSquareBrackets == R.SpaceBeforeSquareBrackets && SpaceInEmptyBlock == R.SpaceInEmptyBlock && - SpaceInEmptyParentheses == R.SpaceInEmptyParentheses && SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments && SpacesInAngles == R.SpacesInAngles && - SpacesInConditionalStatement == R.SpacesInConditionalStatement && SpacesInContainerLiterals == R.SpacesInContainerLiterals && - SpacesInCStyleCastParentheses == R.SpacesInCStyleCastParentheses && SpacesInLineCommentPrefix.Minimum == R.SpacesInLineCommentPrefix.Minimum && SpacesInLineCommentPrefix.Maximum == R.SpacesInLineCommentPrefix.Maximum && - SpacesInParentheses == R.SpacesInParentheses && + SpacesInParens == R.SpacesInParens && + SpacesInParensOptions == R.SpacesInParensOptions && SpacesInSquareBrackets == R.SpacesInSquareBrackets && Standard == R.Standard && StatementAttributeLikeMacros == R.StatementAttributeLikeMacros && - StatementMacros == R.StatementMacros && TabWidth == R.TabWidth && - TypenameMacros == R.TypenameMacros && UseCRLF == R.UseCRLF && - UseTab == R.UseTab && + StatementMacros == R.StatementMacros && + TableGenBreakingDAGArgOperators == + R.TableGenBreakingDAGArgOperators && + TableGenBreakInsideDAGArg == R.TableGenBreakInsideDAGArg && + TabWidth == R.TabWidth && TypeNames == R.TypeNames && + TypenameMacros == R.TypenameMacros && UseTab == R.UseTab && + VerilogBreakBetweenInstancePorts == + R.VerilogBreakBetweenInstancePorts && WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros; } - llvm::Optional GetLanguageStyle(LanguageKind Language) const; + std::optional GetLanguageStyle(LanguageKind Language) const; // Stores per-language styles. A FormatStyle instance inside has an empty // StyleSet. A FormatStyle instance returned by the Get method has its @@ -4215,7 +5173,7 @@ struct FormatStyle { struct FormatStyleSet { typedef std::map MapType; - llvm::Optional Get(FormatStyle::LanguageKind Language) const; + std::optional Get(FormatStyle::LanguageKind Language) const; // Adds \p Style to this FormatStyleSet. Style must not have an associated // FormatStyleSet. @@ -4276,6 +5234,8 @@ FormatStyle getGNUStyle(); /// https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017 FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language); +FormatStyle getClangFormatStyle(); + /// Returns style indicating formatting should be not applied at all. FormatStyle getNoStyle(); @@ -4328,7 +5288,7 @@ tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, /// Returns the replacements corresponding to applying and formatting /// \p Replaces on success; otheriwse, return an llvm::Error carrying /// llvm::StringError. -llvm::Expected +Expected formatReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style); @@ -4342,10 +5302,10 @@ formatReplacements(StringRef Code, const tooling::Replacements &Replaces, /// - If a replacement has offset UINT_MAX, length 1, and a replacement text /// that is the name of the header to be removed, the header will be removed /// from \p Code if it exists. -/// The include manipulation is done via `tooling::HeaderInclude`, see its +/// The include manipulation is done via ``tooling::HeaderInclude``, see its /// documentation for more details on how include insertion points are found and /// what edits are produced. -llvm::Expected +Expected cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style); @@ -4433,11 +5393,11 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style = getLLVMStyle()); extern const char *StyleOptionHelpDescription; /// The suggested format style to use by default. This allows tools using -/// `getStyle` to have a consistent default style. +/// ``getStyle`` to have a consistent default style. /// Different builds can modify the value to the preferred styles. extern const char *DefaultFormatStyle; -/// The suggested predefined style to use as the fallback style in `getStyle`. +/// The suggested predefined style to use as the fallback style in ``getStyle``. /// Different builds can modify the value to the preferred styles. extern const char *DefaultFallbackStyle; @@ -4470,11 +5430,11 @@ extern const char *DefaultFallbackStyle; /// \returns FormatStyle as specified by ``StyleName``. If ``StyleName`` is /// "file" and no file is found, returns ``FallbackStyle``. If no style could be /// determined, returns an Error. -llvm::Expected getStyle(StringRef StyleName, StringRef FileName, - StringRef FallbackStyle, - StringRef Code = "", - llvm::vfs::FileSystem *FS = nullptr, - bool AllowUnknownOptions = false); +Expected +getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyle, + StringRef Code = "", llvm::vfs::FileSystem *FS = nullptr, + bool AllowUnknownOptions = false, + llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr); // Guesses the language from the ``FileName`` and ``Code`` to be formatted. // Defaults to FormatStyle::LK_Cpp. @@ -4508,12 +5468,13 @@ inline StringRef getLanguageName(FormatStyle::LanguageKind Language) { } } +bool isClangFormatOn(StringRef Comment); +bool isClangFormatOff(StringRef Comment); + } // end namespace format } // end namespace clang -namespace std { template <> -struct is_error_code_enum : std::true_type {}; -} // namespace std +struct std::is_error_code_enum : std::true_type {}; #endif // LLVM_CLANG_FORMAT_FORMAT_H diff --git a/schemaGenerator/clang/IncludeStyle.h b/schemaGenerator/clang/IncludeStyle.h index d6b2b01..d167b7e 100644 --- a/schemaGenerator/clang/IncludeStyle.h +++ b/schemaGenerator/clang/IncludeStyle.h @@ -151,6 +151,21 @@ struct IncludeStyle { /// before any other include. /// \version 10 std::string IncludeIsMainSourceRegex; + + /// Character to consider in the include directives for the main header. + enum MainIncludeCharDiscriminator : int8_t { + /// Main include uses quotes: ``#include "foo.hpp"`` (the default). + MICD_Quote, + /// Main include uses angle brackets: ``#include ``. + MICD_AngleBracket, + /// Main include uses either quotes or angle brackets. + MICD_Any + }; + + /// When guessing whether a #include is the "main" include, only the include + /// directives that use the specified character are considered. + /// \version 19 + MainIncludeCharDiscriminator MainIncludeChar; }; } // namespace tooling @@ -174,6 +189,14 @@ struct ScalarEnumerationTraits< enumeration(IO &IO, clang::tooling::IncludeStyle::IncludeBlocksStyle &Value); }; +template <> +struct ScalarEnumerationTraits< + clang::tooling::IncludeStyle::MainIncludeCharDiscriminator> { + static void enumeration( + IO &IO, + clang::tooling::IncludeStyle::MainIncludeCharDiscriminator &Value); +}; + } // namespace yaml } // namespace llvm diff --git a/schemaGenerator/clang/dump_format_style.py b/schemaGenerator/clang/dump_format_style.py new file mode 100644 index 0000000..7d629ad --- /dev/null +++ b/schemaGenerator/clang/dump_format_style.py @@ -0,0 +1,503 @@ +# From https://github.com/llvm/llvm-project/blob/main/clang/docs/tools/dump_format_style.py +# Permament link: https://github.com/llvm/llvm-project/blob/10a1ea9b53647c1511d3cce8fa7637f8ffdb39b5/clang/docs/tools/dump_format_style.py +# With some modifications to export html instead of rst +# fmt: off + +# A tool to parse the FormatStyle struct from Format.h and update the +# documentation in ../ClangFormatStyleOptions.rst automatically. +# Run from the directory in which this file is located to update the docs. + +import inspect +import os +import re +import sys +from io import TextIOWrapper +from typing import Set + +CLANG_DIR = os.path.join(os.path.dirname(__file__), "../../..") +FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, "include/clang/Format/Format.h") +INCLUDE_STYLE_FILE = os.path.join( + CLANG_DIR, "include/clang/Tooling/Inclusions/IncludeStyle.h" +) +DOC_FILE = os.path.join(CLANG_DIR, "docs/ClangFormatStyleOptions.rst") + +PLURALS_FILE = os.path.join(os.path.dirname(__file__), "plurals.txt") + +plurals: Set[str] = set() +with open(PLURALS_FILE, "a+") as f: + f.seek(0) + plurals = set(f.read().splitlines()) + + +def substitute(text, tag, contents): + replacement = "\n.. START_%s\n\n%s\n\n.. END_%s\n" % (tag, contents, tag) + pattern = r"\n\.\. START_%s\n.*\n\.\. END_%s\n" % (tag, tag) + return re.sub(pattern, "%s", text, flags=re.S) % replacement + + +def register_plural(singular: str, plural: str): + if plural not in plurals: + if not hasattr(register_plural, "generated_new_plural"): + print( + "Plural generation: you can use " + f"`git checkout -- {os.path.relpath(PLURALS_FILE)}` " + "to reemit warnings or `git add` to include new plurals\n" + ) + register_plural.generated_new_plural = True + + plurals.add(plural) + with open(PLURALS_FILE, "a") as f: + f.write(plural + "\n") + cf = inspect.currentframe() + lineno = "" + if cf and cf.f_back: + lineno = ":" + str(cf.f_back.f_lineno) + print( + f"{__file__}{lineno} check if plural of {singular} is {plural}", + file=sys.stderr, + ) + return plural + + +def pluralize(word: str): + lword = word.lower() + if len(lword) >= 2 and lword[-1] == "y" and lword[-2] not in "aeiou": + return register_plural(word, word[:-1] + "ies") + elif lword.endswith(("s", "sh", "ch", "x", "z")): + return register_plural(word, word[:-1] + "es") + elif lword.endswith("fe"): + return register_plural(word, word[:-2] + "ves") + elif lword.endswith("f") and not lword.endswith("ff"): + return register_plural(word, word[:-1] + "ves") + else: + return register_plural(word, word + "s") + + +def to_yaml_type(typestr: str): + if typestr == "bool": + return "Boolean" + elif typestr == "int": + return "Integer" + elif typestr == "unsigned": + return "Unsigned" + elif typestr == "std::string": + return "String" + + match = re.match(r"std::vector<(.*)>$", typestr) + if match: + return "List of " + pluralize(to_yaml_type(match.group(1))) + + match = re.match(r"std::optional<(.*)>$", typestr) + if match: + return to_yaml_type(match.group(1)) + + return typestr + + +def doxygen2rst(text): + text = re.sub(r"\s*(.*?)\s*<\/tt>", r"``\1``", text) + text = re.sub(r"\\c ([^ ,;\.]+)", r"``\1``", text) + text = re.sub(r"\\\w+ ", "", text) + return text + + +def indent(text, columns, indent_first_line=True): + indent_str = " " * columns + s = re.sub(r"\n([^\n])", "\n" + indent_str + "\\1", text, flags=re.S) + if not indent_first_line or s.startswith("\n"): + return s + return indent_str + s + + +class Option(object): + def __init__(self, name, opt_type, comment, version): + self.name = name + self.type = opt_type + self.comment = comment.strip() + self.enum = None + self.nested_struct = None + self.version = version + + def __str__(self): + s = ".. _%s:\n\n**%s** (``%s``) " % ( + self.name, + self.name, + to_yaml_type(self.type), + ) + if self.version: + s += ":versionbadge:`clang-format %s` " % self.version + s += ":ref:`¶ <%s>`\n%s" % (self.name, doxygen2rst(indent(self.comment, 2))) + if self.enum and self.enum.values: + s += indent("\n\nPossible values:\n\n%s\n" % self.enum, 2) + if self.nested_struct: + s += indent( + "\n\nNested configuration flags:\n\n%s\n" % self.nested_struct, 2 + ) + s = s.replace("", self.name) + return s + + +class NestedStruct(object): + def __init__(self, name, comment): + self.name = name + self.comment = comment.strip() + self.values = [] + + def __str__(self): + return self.comment + "\n" + "\n".join(map(str, self.values)) + + +class NestedField(object): + def __init__(self, name, comment, version): + self.name = name + self.comment = comment.strip() + self.version = version + + def __str__(self): + if self.version: + return "\n* ``%s`` :versionbadge:`clang-format %s`\n%s" % ( + self.name, + self.version, + doxygen2rst(indent(self.comment, 2, indent_first_line=False)), + ) + return "\n* ``%s`` %s" % ( + self.name, + doxygen2rst(indent(self.comment, 2, indent_first_line=False)), + ) + + +class Enum(object): + def __init__(self, name, comment): + self.name = name + self.comment = comment.strip() + self.values = [] + + def __str__(self): + return "\n".join(map(str, self.values)) + + +class NestedEnum(object): + def __init__(self, name, enumtype, comment, version, values): + self.name = name + self.comment = comment + self.values = values + self.type = enumtype + self.version = version + + def __str__(self): + s = "" + if self.version: + s = "\n* ``%s %s`` :versionbadge:`clang-format %s`\n\n%s" % ( + to_yaml_type(self.type), + self.name, + self.version, + doxygen2rst(indent(self.comment, 2)), + ) + else: + s = "\n* ``%s %s``\n%s" % ( + to_yaml_type(self.type), + self.name, + doxygen2rst(indent(self.comment, 2)), + ) + s += indent("\nPossible values:\n\n", 2) + s += indent("\n".join(map(str, self.values)), 2) + return s + + +class EnumValue(object): + def __init__(self, name, comment, config): + self.name = name + self.comment = comment + self.config = config + + def __str__(self): + return "* ``%s`` (in configuration: ``%s``)\n%s" % ( + self.name, + re.sub(".*_", "", self.config), + doxygen2rst(indent(self.comment, 2)), + ) + + +class OptionsReader: + def __init__(self, header: TextIOWrapper): + self.header = header + self.in_code_block = False + self.code_indent = 0 + self.lineno = 0 + self.last_err_lineno = -1 + + def __file_path(self): + return os.path.relpath(self.header.name) + + def __print_line(self, line: str): + print(f"{self.lineno:>6} | {line}", file=sys.stderr) + + def __warning(self, msg: str, line: str): + print(f"{self.__file_path()}:{self.lineno}: warning: {msg}:", file=sys.stderr) + self.__print_line(line) + + def __clean_comment_line(self, line: str): + if line.strip() == "///" and not self.in_code_block: + return "

" + + match = re.match(r"^/// (?P +)?\\code(\{.(?P\w+)\})?$", line) + if match: + if self.in_code_block: + self.__warning("`\\code` in another `\\code`", line) + self.in_code_block = True + indent_str = match.group("indent") + if not indent_str: + indent_str = "" + self.code_indent = len(indent_str) + lang = match.group("lang") + if not lang: + lang = "c++" + + # Format the code block + return f"\n

"
+
+        endcode_match = re.match(r"^/// +\\endcode$", line)
+        if endcode_match:
+            if not self.in_code_block:
+                self.__warning(
+                    "no correct `\\code` found before this `\\endcode`", line
+                )
+            self.in_code_block = False
+            return "
\n" + + # check code block indentation + if ( + self.in_code_block + and not line == "///" + and not line.startswith("/// " + " " * self.code_indent) + ): + if self.last_err_lineno == self.lineno - 1: + self.__print_line(line) + else: + self.__warning("code block should be indented", line) + self.last_err_lineno = self.lineno + + if self.in_code_block: + line = line.replace("<", "<") + line = line.replace(">", ">") + + match = re.match(r"^/// \\warning$", line) + if match: + return "Warning:" + + endwarning_match = re.match(r"^/// +\\endwarning$", line) + if endwarning_match: + return "" + + match = re.match(r"^/// \\note$", line) + if match: + return "Note" + + endnote_match = re.match(r"^/// +\\endnote$", line) + if endnote_match: + return "" + return line[4:] + "\n" + + def read_options(self): + class State: + ( + BeforeStruct, + Finished, + InStruct, + InNestedStruct, + InNestedFieldComment, + InFieldComment, + InEnum, + InEnumMemberComment, + InNestedEnum, + InNestedEnumMemberComment, + ) = range(10) + + state = State.BeforeStruct + + options = [] + enums = {} + nested_structs = {} + comment = "" + enum = None + nested_struct = None + version = None + deprecated = False + + for line in self.header: + self.lineno += 1 + line = line.strip() + if state == State.BeforeStruct: + if line in ("struct FormatStyle {", "struct IncludeStyle {"): + state = State.InStruct + elif state == State.InStruct: + if line.startswith("///"): + state = State.InFieldComment + comment = self.__clean_comment_line(line) + elif line == "};": + state = State.Finished + break + elif state == State.InFieldComment: + if line.startswith(r"/// \version"): + match = re.match(r"/// \\version\s*(?P[0-9.]+)*", line) + if match: + version = match.group("version") + elif line.startswith("/// @deprecated"): + deprecated = True + elif line.startswith("///"): + comment += self.__clean_comment_line(line) + elif line.startswith("enum"): + state = State.InEnum + name = re.sub(r"enum\s+(\w+)\s*(:((\s*\w+)+)\s*)?\{", "\\1", line) + enum = Enum(name, comment) + elif line.startswith("struct"): + state = State.InNestedStruct + name = re.sub(r"struct\s+(\w+)\s*\{", "\\1", line) + nested_struct = NestedStruct(name, comment) + elif line.endswith(";"): + prefix = "// " + if line.startswith(prefix): + line = line[len(prefix):] + state = State.InStruct + field_type, field_name = re.match( + r"([<>:\w(,\s)]+)\s+(\w+);", line + ).groups() + if deprecated: + field_type = "deprecated" + deprecated = False + + if not version: + self.__warning(f"missing version for {field_name}", line) + option = Option(str(field_name), str(field_type), comment, version) + options.append(option) + version = None + else: + raise Exception( + "Invalid format, expected comment, field or enum\n" + line + ) + elif state == State.InNestedStruct: + if line.startswith("///"): + state = State.InNestedFieldComment + comment = self.__clean_comment_line(line) + elif line == "};": + state = State.InStruct + nested_structs[nested_struct.name] = nested_struct + elif state == State.InNestedFieldComment: + if line.startswith(r"/// \version"): + match = re.match(r"/// \\version\s*(?P[0-9.]+)*", line) + if match: + version = match.group("version") + elif line.startswith("///"): + comment += self.__clean_comment_line(line) + elif line.startswith("enum"): + state = State.InNestedEnum + name = re.sub(r"enum\s+(\w+)\s*(:((\s*\w+)+)\s*)?\{", "\\1", line) + enum = Enum(name, comment) + else: + state = State.InNestedStruct + field_type, field_name = re.match( + r"([<>:\w(,\s)]+)\s+(\w+);", line + ).groups() + # if not version: + # self.__warning(f"missing version for {field_name}", line) + if field_type in enums: + nested_struct.values.append( + NestedEnum( + field_name, + field_type, + comment, + version, + enums[field_type].values, + ) + ) + else: + nested_struct.values.append( + NestedField(field_type + " " + field_name, comment, version) + ) + version = None + elif state == State.InEnum: + if line.startswith("///"): + state = State.InEnumMemberComment + comment = self.__clean_comment_line(line) + elif line == "};": + state = State.InStruct + enums[enum.name] = enum + else: + # Enum member without documentation. Must be documented where the enum + # is used. + pass + elif state == State.InNestedEnum: + if line.startswith("///"): + state = State.InNestedEnumMemberComment + comment = self.__clean_comment_line(line) + elif line == "};": + state = State.InNestedStruct + enums[enum.name] = enum + else: + # Enum member without documentation. Must be + # documented where the enum is used. + pass + elif state == State.InEnumMemberComment: + if line.startswith("///"): + comment += self.__clean_comment_line(line) + else: + state = State.InEnum + val = line.replace(",", "") + pos = val.find(" // ") + if pos != -1: + config = val[pos + 4:] + val = val[:pos] + else: + config = val + enum.values.append(EnumValue(val, comment, config)) + elif state == State.InNestedEnumMemberComment: + if line.startswith("///"): + comment += self.__clean_comment_line(line) + else: + state = State.InNestedEnum + val = line.replace(",", "") + pos = val.find(" // ") + if pos != -1: + config = val[pos + 4:] + val = val[:pos] + else: + config = val + enum.values.append(EnumValue(val, comment, config)) + if state != State.Finished: + raise Exception("Not finished by the end of file") + + for option in options: + if option.type not in [ + "bool", + "unsigned", + "int", + "std::string", + "std::vector", + "std::vector", + "std::vector", + "std::optional", + "deprecated", + ]: + if option.type in enums: + option.enum = enums[option.type] + elif option.type in nested_structs: + option.nested_struct = nested_structs[option.type] + else: + raise Exception("Unknown type: %s" % option.type) + return options, nested_structs, enums + +# with open(FORMAT_STYLE_FILE) as f: +# opts = OptionsReader(f).read_options() +# with open(INCLUDE_STYLE_FILE) as f: +# opts += OptionsReader(f).read_options() +# +# opts = sorted(opts, key=lambda x: x.name) +# options_text = "\n\n".join(map(str, opts)) +# +# with open(DOC_FILE, encoding="utf-8") as f: +# contents = f.read() +# +# contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text) +# +# with open(DOC_FILE, "wb") as output: +# output.write(contents.encode()) diff --git a/schemaGenerator/plurals.txt b/schemaGenerator/clang/plurals.txt similarity index 100% rename from schemaGenerator/plurals.txt rename to schemaGenerator/clang/plurals.txt diff --git a/schemaGenerator/dump_format_style.py b/schemaGenerator/dump_format_style.py deleted file mode 100755 index 55f95d0..0000000 --- a/schemaGenerator/dump_format_style.py +++ /dev/null @@ -1,361 +0,0 @@ -#!/usr/bin/env python3 -# From https://github.com/llvm/llvm-project/blob/main/clang/docs/tools/dump_format_style.py -# A tool to parse the FormatStyle struct from Format.h and update the -# documentation in ../ClangFormatStyleOptions.rst automatically. -# Run from the directory in which this file is located to update the docs. - -import inspect -import os -import re -import sys -from io import TextIOWrapper -from typing import Set - -CLANG_DIR = os.path.join(os.path.dirname(__file__), '../..') -FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Format/Format.h') -INCLUDE_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Tooling/Inclusions/IncludeStyle.h') -DOC_FILE = os.path.join(CLANG_DIR, 'docs/ClangFormatStyleOptions.rst') - -PLURALS_FILE = os.path.join(os.path.dirname(__file__), 'plurals.txt') - -plurals: Set[str] = set() -with open(PLURALS_FILE, 'a+') as f: - f.seek(0) - plurals = set(f.read().splitlines()) - -def substitute(text, tag, contents): - replacement = '\n.. START_%s\n\n%s\n\n.. END_%s\n' % (tag, contents, tag) - pattern = r'\n\.\. START_%s\n.*\n\.\. END_%s\n' % (tag, tag) - return re.sub(pattern, '%s', text, flags=re.S) % replacement - -def register_plural(singular: str, plural: str): - if plural not in plurals: - if not hasattr(register_plural, "generated_new_plural"): - print('Plural generation: you can use ' - f'`git checkout -- {os.path.relpath(PLURALS_FILE)}` ' - 'to reemit warnings or `git add` to include new plurals\n') - register_plural.generated_new_plural = True - - plurals.add(plural) - with open(PLURALS_FILE, 'a') as f: - f.write(plural + '\n') - cf = inspect.currentframe() - lineno = '' - if cf and cf.f_back: - lineno = ':' + str(cf.f_back.f_lineno) - print(f'{__file__}{lineno} check if plural of {singular} is {plural}', file=sys.stderr) - return plural - -def pluralize(word: str): - lword = word.lower() - if len(lword) >= 2 and lword[-1] == 'y' and lword[-2] not in 'aeiou': - return register_plural(word, word[:-1] + 'ies') - elif lword.endswith(('s', 'sh', 'ch', 'x', 'z')): - return register_plural(word, word[:-1] + 'es') - elif lword.endswith('fe'): - return register_plural(word, word[:-2] + 'ves') - elif lword.endswith('f') and not lword.endswith('ff'): - return register_plural(word, word[:-1] + 'ves') - else: - return register_plural(word, word + 's') - - -def to_yaml_type(typestr: str): - if typestr == 'bool': - return 'Boolean' - elif typestr == 'int': - return 'Integer' - elif typestr == 'unsigned': - return 'Unsigned' - elif typestr == 'std::string': - return 'String' - - subtype, napplied = re.subn(r'^std::vector<(.*)>$', r'\1', typestr) - if napplied == 1: - return 'List of ' + pluralize(to_yaml_type(subtype)) - - return typestr - -def doxygen2rst(text): - text = re.sub(r'\s*(.*?)\s*<\/tt>', r'``\1``', text) - text = re.sub(r'\\c ([^ ,;\.]+)', r'``\1``', text) - text = re.sub(r'\\\w+ ', '', text) - return text - -def indent(text, columns, indent_first_line=True): - indent_str = ' ' * columns - s = re.sub(r'\n([^\n])', '\n' + indent_str + '\\1', text, flags=re.S) - if not indent_first_line or s.startswith('\n'): - return s - return indent_str + s - -class Option(object): - def __init__(self, name, opt_type, comment, version): - self.name = name - self.type = opt_type - self.comment = comment.strip() - self.enum = None - self.nested_struct = None - self.version = version - - def __str__(self): - if self.version: - s = '**%s** (``%s``) :versionbadge:`clang-format %s`\n%s' % (self.name, to_yaml_type(self.type), self.version, - doxygen2rst(indent(self.comment, 2))) - else: - s = '**%s** (``%s``)\n%s' % (self.name, to_yaml_type(self.type), - doxygen2rst(indent(self.comment, 2))) - if self.enum and self.enum.values: - s += indent('\n\nPossible values:\n\n%s\n' % self.enum, 2) - if self.nested_struct: - s += indent('\n\nNested configuration flags:\n\n%s\n' %self.nested_struct, - 2) - return s - -class NestedStruct(object): - def __init__(self, name, comment): - self.name = name - self.comment = comment.strip() - self.values = [] - - def __str__(self): - return self.comment + '\n' + '\n'.join(map(str, self.values)) - -class NestedField(object): - def __init__(self, name, comment): - self.name = name - self.comment = comment.strip() - - def __str__(self): - return '\n* ``%s`` %s' % ( - self.name, - doxygen2rst(indent(self.comment, 2, indent_first_line=False))) - -class Enum(object): - def __init__(self, name, comment): - self.name = name - self.comment = comment.strip() - self.values = [] - - def __str__(self): - return '\n'.join(map(str, self.values)) - -class NestedEnum(object): - def __init__(self, name, enumtype, comment, values): - self.name = name - self.comment = comment - self.values = values - self.type = enumtype - - def __str__(self): - s = '\n* ``%s %s``\n%s' % (to_yaml_type(self.type), self.name, - doxygen2rst(indent(self.comment, 2))) - s += indent('\nPossible values:\n\n', 2) - s += indent('\n'.join(map(str, self.values)), 2) - return s - -class EnumValue(object): - def __init__(self, name, comment, config): - self.name = name - self.comment = comment - self.config = config - - def __str__(self): - return '* ``%s`` (in configuration: ``%s``)\n%s' % ( - self.name, - re.sub('.*_', '', self.config), - doxygen2rst(indent(self.comment, 2))) - - -class OptionsReader: - def __init__(self, header: TextIOWrapper): - self.header = header - self.in_code_block = False - self.code_indent = 0 - self.lineno = 0 - self.last_err_lineno = -1 - - def __file_path(self): - return os.path.relpath(self.header.name) - - def __print_line(self, line: str): - print(f'{self.lineno:>6} | {line}', file=sys.stderr) - - def __warning(self, msg: str, line: str): - print(f'{self.__file_path()}:{self.lineno}: warning: {msg}:', file=sys.stderr) - self.__print_line(line) - - def __clean_comment_line(self, line: str): - match = re.match(r'^/// (?P +)?\\code(\{.(?P\w+)\})?$', line) - if match: - if self.in_code_block: - self.__warning('`\\code` in another `\\code`', line) - self.in_code_block = True - indent_str = match.group('indent') - if not indent_str: - indent_str = '' - self.code_indent = len(indent_str) - lang = match.group('lang') - if not lang: - lang = 'c++' - return f'\n{indent_str}.. code-block:: {lang}\n\n' - - endcode_match = re.match(r'^/// +\\endcode$', line) - if endcode_match: - if not self.in_code_block: - self.__warning('no correct `\\code` found before this `\\endcode`', line) - self.in_code_block = False - return '' - - # check code block indentation - if (self.in_code_block and not line == '///' and not - line.startswith('/// ' + ' ' * self.code_indent)): - if self.last_err_lineno == self.lineno - 1: - self.__print_line(line) - else: - self.__warning('code block should be indented', line) - self.last_err_lineno = self.lineno - - match = re.match(r'^/// \\warning$', line) - if match: - return '\n.. warning:: \n\n' - - endwarning_match = re.match(r'^/// +\\endwarning$', line) - if endwarning_match: - return '' - return line[4:] + '\n' - - def read_options(self): - class State: - BeforeStruct, Finished, InStruct, InNestedStruct, InNestedFieldComment, \ - InFieldComment, InEnum, InEnumMemberComment = range(8) - state = State.BeforeStruct - - options = [] - enums = {} - nested_structs = {} - comment = '' - enum = None - nested_struct = None - version = None - - for line in self.header: - self.lineno += 1 - line = line.strip() - if state == State.BeforeStruct: - if line in ('struct FormatStyle {', 'struct IncludeStyle {'): - state = State.InStruct - elif state == State.InStruct: - if line.startswith('///'): - state = State.InFieldComment - comment = self.__clean_comment_line(line) - elif line == '};': - state = State.Finished - break - elif state == State.InFieldComment: - if line.startswith(r'/// \version'): - match = re.match(r'/// \\version\s*(?P[0-9.]+)*', line) - if match: - version = match.group('version') - elif line.startswith('///'): - comment += self.__clean_comment_line(line) - elif line.startswith('enum'): - state = State.InEnum - name = re.sub(r'enum\s+(\w+)\s*(:((\s*\w+)+)\s*)?\{', '\\1', line) - enum = Enum(name, comment) - elif line.startswith('struct'): - state = State.InNestedStruct - name = re.sub(r'struct\s+(\w+)\s*\{', '\\1', line) - nested_struct = NestedStruct(name, comment) - elif line.endswith(';'): - prefix = '// ' - if line.startswith(prefix): - line = line[len(prefix):] - state = State.InStruct - field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);', - line).groups() - - if not version: - self.__warning(f'missing version for {field_name}', line) - option = Option(str(field_name), str(field_type), comment, version) - options.append(option) - version = None - else: - raise Exception('Invalid format, expected comment, field or enum\n' + line) - elif state == State.InNestedStruct: - if line.startswith('///'): - state = State.InNestedFieldComment - comment = self.__clean_comment_line(line) - elif line == '};': - state = State.InStruct - nested_structs[nested_struct.name] = nested_struct - elif state == State.InNestedFieldComment: - if line.startswith('///'): - comment += self.__clean_comment_line(line) - else: - state = State.InNestedStruct - field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);', line).groups() - if field_type in enums: - nested_struct.values.append(NestedEnum(field_name, - field_type, - comment, - enums[field_type].values)) - else: - nested_struct.values.append(NestedField(field_type + " " + field_name, comment)) - - elif state == State.InEnum: - if line.startswith('///'): - state = State.InEnumMemberComment - comment = self.__clean_comment_line(line) - elif line == '};': - state = State.InStruct - enums[enum.name] = enum - else: - # Enum member without documentation. Must be documented where the enum - # is used. - pass - elif state == State.InEnumMemberComment: - if line.startswith('///'): - comment += self.__clean_comment_line(line) - else: - state = State.InEnum - val = line.replace(',', '') - pos = val.find(" // ") - if pos != -1: - config = val[pos + 4:] - val = val[:pos] - else: - config = val - enum.values.append(EnumValue(val, comment, config)) - if state != State.Finished: - raise Exception('Not finished by the end of file') - - for option in options: - if option.type not in ['bool', 'unsigned', 'int', 'std::string', - 'std::vector', - 'std::vector', - 'std::vector']: - if option.type in enums: - option.enum = enums[option.type] - elif option.type in nested_structs: - option.nested_struct = nested_structs[option.type] - else: - raise Exception('Unknown type: %s' % option.type) - return options - - -# with open(FORMAT_STYLE_FILE) as f: -# opts = OptionsReader(f).read_options() -# with open(INCLUDE_STYLE_FILE) as f: -# opts += OptionsReader(f).read_options() -# -# opts = sorted(opts, key=lambda x: x.name) -# options_text = '\n\n'.join(map(str, opts)) -# -# with open(DOC_FILE) as f: -# contents = f.read() -# -# contents = substitute(contents, 'FORMAT_STYLE_OPTIONS', options_text) -# -# with open(DOC_FILE, 'wb') as output: -# output.write(contents.encode()) diff --git a/schemaGenerator/generate_schema.py b/schemaGenerator/generate_schema.py index a3517c1..3e35187 100755 --- a/schemaGenerator/generate_schema.py +++ b/schemaGenerator/generate_schema.py @@ -1,21 +1,32 @@ #!/usr/bin/env python +import argparse import io import json import re import urllib.request from pathlib import Path -from dump_format_style import OptionsReader, Option +from clang.dump_format_style import ( + OptionsReader, + Option, + NestedEnum, + NestedField, + NestedStruct, + Enum, +) # Generates "clangFormat-options.json" from clang-format. # Should be run for every llvm update. # Based on dump_format_style.py -CLANG_BRANCH = "main" -PROJECT_ROOT = Path(__file__).parent.parent +# Update the CLANG_BRANCH to the latest version +CLANG_BRANCH = "release/19.x" +CLANG_ROOT = f"https://raw.githubusercontent.com/llvm/llvm-project/{CLANG_BRANCH}/clang" +PROJECT_ROOT = Path(__file__).parent.parent OUTPUT_FILE = str(PROJECT_ROOT / "src/main/resources/schemas/clangFormat-options.json") -CLANG_ROOT = f"https://raw.githubusercontent.com/llvm/llvm-project/{CLANG_BRANCH}/clang" + +PARAGRAPH_BEGIN = "

" def download_file(url, file_name): @@ -23,72 +34,161 @@ def download_file(url, file_name): urllib.request.urlretrieve(url, file_name) -def remove_doxygen(text): - text = re.sub(r'\s*(.*?)\s*<\/tt>', r'\1', text) - text = re.sub(r'\\c ([^ ,;\.]+)', r'\1', text) - text = re.sub(r'\\\w+ ', '', text) - text = re.sub(r'\n *\n', '\n', text) - text = re.sub(r'<[^>]*>', '', text) +def remove_rst(text): + text = re.sub(r"\s*(.*?)\s*<\/tt>", r"\1", text) + text = re.sub(r"\\c ([^ ,;\.]+)", r"\1", text) + text = re.sub(r"\\\w+ ", "", text) + text = re.sub(r"\n *\n", "\n", text) + text = re.sub(r"<[^>]*>", "", text) return text -def doxygen2html(text): - text = re.sub(r'\s*(.*?)\s*', r'``\1``', text) - text = re.sub(r'\\c ([^ ,;.]+)', r'``\1``', text) - text = re.sub(r'\\\w+ ', '', text) - text = re.sub(r'\n *\n', '\n

', text) - return '

' + text +def rst2html(text): + text = re.sub(r"\s*(.*?)\s*", r"\1", text) + text = re.sub(r"\\c ([^ ,;.]+)", r"\1", text) + text = re.sub(r"``(.*?)``", r"\1", text) + text = re.sub(r"\\\w+ ", "", text) + # text = re.sub(r"\n *\n", "\n" + PARAGRAPH_BEGIN, text) + + # Links + text = re.sub(r"(?()]+)", r"\1", text) + text = re.sub(r"`([^<]+) *<(.+)>`_", r"\1", text) + + return text + + +def make_link(name): + return f"https://clang.llvm.org/docs/ClangFormatStyleOptions.html#{name.lower()}" + + +def make_anchor(name): + return f"{name} Documentation\n" + + +def split_enum_value(x: str): + return x.split("_")[1] + +def split_subfield_name(x: str): + return x.split(" ")[1] if " " in x else x -def generate_json(options: list[Option]): + +def make_based_on_style(desc): + return { + "x-intellij-html-description": desc, + "type": "string", + "enum": [ + "LLVM", + "Google", + "Chromium", + "Mozilla", + "WebKit", + "Microsoft", + "GNU", + "InheritParentConfig", + ], + "x-intellij-enum-metadata": { + "LLVM": {"description": "A style complying with the LLVM coding standards"}, + "Google": { + "description": "A style complying with Google's C++ style guide", + }, + "Chromium": { + "description": "A style complying with Chromium's style guide" + }, + "Mozilla": {"description": "A style complying with Mozilla's style guide"}, + "WebKit": {"description": "A style complying with WebKit's style guide"}, + "Microsoft": { + "description": "A style complying with Microsoft's style guide" + }, + "GNU": {"description": "A style complying with the GNU coding standards"}, + }, + "x-intellij-enum-order-sensitive": True, + } + + +def option2schema( + opt: Option, nested_structs: dict[str, NestedStruct], enums: dict[str, Enum] +): def get_type(cpp_type: str): - if cpp_type in ['int', 'unsigned']: + if cpp_type in ["int", "unsigned", "int8_t"]: return {"type": "number"} - if cpp_type == 'bool': + if cpp_type == "bool": return {"type": "boolean"} - if cpp_type == 'std::string': + if cpp_type == "std::string": return {"type": "string"} - if cpp_type == 'std::vector': - return {"type": "array", "items": {"type": "string"}} + if cpp_type == "deprecated": + return {} + + if match := re.match(r"std::vector<(.+)>", cpp_type): + return {"type": "array", "items": get_type(match.group(1))} + + if match := re.match(r"std::optional<(.+)>", cpp_type): + return {"type": get_type(match.group(1))} + + if cpp_type in nested_structs: + sub_properties = {} + + struct = nested_structs[cpp_type] + for nested_opt in sorted(struct.values, key=lambda x: x.name): + sub_prop = {} + if isinstance(nested_opt, NestedField): + sub_prop = get_type(nested_opt.name.split(" ")[0]) + elif isinstance(nested_opt, NestedEnum): + full_description = nested_opt.comment + "

" + "Possible values: " + for enum_value in nested_opt.values: + full_description += f" {enum_value.name}" + sub_prop["x-intellij-html-description"] = rst2html(full_description) + + # link the root option since nested structs doesn't have fragments + sub_prop["x-intellij-html-description"] = ( + f"{rst2html(nested_opt.comment)}

{make_anchor(opt.name)}" + ) + + sub_properties[split_subfield_name(nested_opt.name)] = sub_prop + + return { + "type": "object", + "additionalProperties": False, + "properties": sub_properties, + } + + if cpp_type in enums: + enum = enums[cpp_type] + return { + "type": "string", + "enum": [split_enum_value(x.name) for x in enum.values], + "x-intellij-enum-metadata": { + split_enum_value(x.name): { + "description": remove_rst(x.comment.split("\n")[0]) + } + for x in enum.values + }, + } + + print(f"Unknown type: {cpp_type}") return {"type": f"???({cpp_type})"} - def make_link(name): - return f"https://clang.llvm.org/docs/ClangFormatStyleOptions.html#:~:text={name}%20(" - - def make_anchor(name): - return f"Documentation\n" - - def split_enum_value(x: str): - return x.split('_')[1] - - def split_subfield_name(x: str): - return x.split(' ')[1] if ' ' in x else x - - def make_based_on_style(desc): - return { - "x-intellij-html-description": desc, - "type": "string", - "enum": [ - "LLVM", - "Google", - "Chromium", - "Mozilla", - "WebKit", - "Microsoft", - "GNU", - "InheritParentConfig" - ], - "x-intellij-enum-metadata": { - "LLVM": {"description": "A style complying with the LLVM coding standards"}, - "Google": {"description": "A style complying with Google's C++ style guide", }, - "Chromium": {"description": "A style complying with Chromium's style guide"}, - "Mozilla": {"description": "A style complying with Mozilla's style guide"}, - "WebKit": {"description": "A style complying with WebKit's style guide"}, - "Microsoft": {"description": "A style complying with Microsoft's style guide"}, - "GNU": {"description": "A style complying with the GNU coding standards"}, - }, - } + value = get_type(opt.type) + + # https://www.jetbrains.com/help/idea/json.html#ws_json_show_doc_in_html + full_doc = f"{make_anchor(opt.name)}" + full_doc += PARAGRAPH_BEGIN + rst2html(opt.comment) + if opt.nested_struct: + full_doc += PARAGRAPH_BEGIN + rst2html(opt.nested_struct.comment) + if opt.version: + full_doc += PARAGRAPH_BEGIN + f"From clang-format {opt.version}" + if opt.enum: + full_doc += PARAGRAPH_BEGIN + "Invoke completion to see all options" + value["x-intellij-html-description"] = full_doc + + return value + +def generate_schema( + options: list[Option], + nested_structs: dict[str, NestedStruct], + enums: dict[str, Enum], +): # doc: https://json-schema.org/understanding-json-schema/reference/object.html schema = { "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -97,130 +197,60 @@ def make_based_on_style(desc): "additionalProperties": False, "properties": {}, } + + # BasedOnStyle is not in the Format.h file + schema["properties"]["BasedOnStyle"] = make_based_on_style( + make_anchor("BasedOnStyle") + + "The style used for all options not specifically set in the configuration." + + PARAGRAPH_BEGIN + + "Invoke completion to see all options" + ) + for opt in options: - value = {} - - based_on_style = make_based_on_style( - make_anchor("BasedOnStyle") + "The style used for all options not specifically set in the configuration.") - based_on_style["x-romolo-link"] = make_link("BasedOnStyle") - schema['properties']["BasedOnStyle"] = based_on_style - - if opt.name == 'IncludeCategories': - value = { - "type": "array", - "items": { - "type": "object", - "properties": { - "Regex": { - "type": "string" - }, - "Priority": { - "type": "integer" - }, - "SortPriority": { - "type": "integer" - }, - "CaseSensitive": { - "type": "boolean" - } - } - }, - } - elif opt.name == 'RawStringFormats': - value = { - "type": "array", - "items": { - "type": "object", - "properties": { - "Language": { - "x-intellij-html-description": "The language of this raw string.", - "type": "string", - "enum": [ - "None", - "Cpp", - "CSharp", - "Java", - "JavaScript", - "ObjC", - "Proto", - "TableGen", - "TextProto" - ], - }, - "Delimiters": { - "x-intellij-html-description": "A list of raw string delimiters that match this language.", - "type": "array", - "items": { - "type": "string" - } - }, - "EnclosingFunctions": { - "x-intellij-html-description": "A list of enclosing function names that match this language.", - "type": "array", - "items": { - "type": "string" - } - }, - "BasedOnStyle": make_based_on_style( - "The style name on which this raw string format is based on." - " If not specified, the raw string format is based on the style that this format is based on."), - "CanonicalDelimiter": { - "x-intellij-html-description": "The canonical delimiter for this language.", - "type": "string" - } - } - }, - } - elif opt.nested_struct: - value["type"] = "object" - value["additionalProperties"] = False - # NestedEnum or NestedField - sub_properties = {} - for nestedOpt in opt.nested_struct.values: - sub_prop = {} - if ' ' in nestedOpt.name: - # field value - sub_prop = get_type(nestedOpt.name.split(' ')[0]) - pass - sub_prop["x-intellij-html-description"] = doxygen2html(nestedOpt.comment) - sub_properties[split_subfield_name(nestedOpt.name)] = sub_prop - value["properties"] = sub_properties - elif opt.enum is not None: - value["type"] = "string" - value["enum"] = [split_enum_value(x.name) for x in opt.enum.values] - value["x-intellij-enum-metadata"] = {split_enum_value(x.name): {"description": remove_doxygen(x.comment.split('\n')[0])} for x - in opt.enum.values} - else: - value = get_type(opt.type) - - # https://www.jetbrains.com/help/idea/json.html#ws_json_show_doc_in_html - # value["title"] = remove_doxygen(opt.comment.split('\n')[0]) - value["x-intellij-html-description"] = f'{doxygen2html(opt.comment)}

{make_anchor(opt.name)}' - - schema['properties'][opt.name] = value - - return json.dumps(schema, indent=2) + schema["properties"][opt.name] = option2schema(opt, nested_structs, enums) + + return json.dumps(schema, indent=2) + "\n" def main(): + parser = argparse.ArgumentParser() + + parser.add_argument( + "--download", + action="store_true", + help="Download the latest version of the schema from the GitHub", + ) + + args = parser.parse_args() + # Download the latest version of the schema from the GitHub - download_file(f"{CLANG_ROOT}/include/clang/Format/Format.h", "clang/Format.h") - download_file(f"{CLANG_ROOT}/include/clang/Tooling/Inclusions/IncludeStyle.h", "clang/IncludeStyle.h") + if args.download: + download_file(f"{CLANG_ROOT}/include/clang/Format/Format.h", "clang/Format.h") + download_file( + f"{CLANG_ROOT}/include/clang/Tooling/Inclusions/IncludeStyle.h", + "clang/IncludeStyle.h", + ) # Parse the schema print("Parsing the schema") with io.open("clang/Format.h") as f: - opts = OptionsReader(f).read_options() + options, nested_structs, enums = OptionsReader(f).read_options() with io.open("clang/IncludeStyle.h") as f: - opts += OptionsReader(f).read_options() + it_options, it_nested_structs, it_enums = OptionsReader(f).read_options() + options += it_options + nested_structs = {**nested_structs, **it_nested_structs} + enums = {**enums, **it_enums} + + options = sorted(options, key=lambda x: x.name) + + # print("\n".join([str(x) for x in options])) - opts = sorted(opts, key=lambda x: x.name) - generate_json(opts) + schema = generate_schema(options, nested_structs, enums) print(f"Writing the schema to {OUTPUT_FILE}") - with open(OUTPUT_FILE, 'wb') as output: - output.write(generate_json(opts).encode()) + with open(OUTPUT_FILE, "w", encoding="utf-8") as output: + output.write(schema) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/src/main/kotlin/com/github/aarcangeli/ideaclangformat/services/ClangFormatStyleServiceImpl.kt b/src/main/kotlin/com/github/aarcangeli/ideaclangformat/services/ClangFormatStyleServiceImpl.kt index 85b2059..4db5b46 100644 --- a/src/main/kotlin/com/github/aarcangeli/ideaclangformat/services/ClangFormatStyleServiceImpl.kt +++ b/src/main/kotlin/com/github/aarcangeli/ideaclangformat/services/ClangFormatStyleServiceImpl.kt @@ -280,4 +280,3 @@ class ClangFormatStyleServiceImpl : ClangFormatStyleService, Disposable { } } } - diff --git a/src/main/resources/schemas/clangFormat-options.json b/src/main/resources/schemas/clangFormat-options.json index 5d43e85..509ca82 100644 --- a/src/main/resources/schemas/clangFormat-options.json +++ b/src/main/resources/schemas/clangFormat-options.json @@ -5,7 +5,7 @@ "additionalProperties": false, "properties": { "BasedOnStyle": { - "x-intellij-html-description": "Documentation\nThe style used for all options not specifically set in the configuration.", + "x-intellij-html-description": "BasedOnStyle Documentation\nThe style used for all options not specifically set in the configuration.

Invoke completion to see all options", "type": "string", "enum": [ "LLVM", @@ -40,11 +40,11 @@ "description": "A style complying with the GNU coding standards" } }, - "x-romolo-link": "https://clang.llvm.org/docs/ClangFormatStyleOptions.html#:~:text=BasedOnStyle%20(" + "x-intellij-enum-order-sensitive": true }, "AccessModifierOffset": { "type": "number", - "x-intellij-html-description": "

The extra indent or outdent of access modifiers, e.g. ``public:``.

Documentation\n" + "x-intellij-html-description": "AccessModifierOffset Documentation\n

The extra indent or outdent of access modifiers, e.g. public:.

From clang-format 3.3" }, "AlignAfterOpenBracket": { "type": "string", @@ -68,7 +68,7 @@ "description": "Always break after an open bracket, if the parameters don't fit" } }, - "x-intellij-html-description": "

If ``true``, horizontally aligns arguments after an open bracket.\n

This applies to round brackets (parentheses), angle brackets and square\nbrackets.

Documentation\n" + "x-intellij-html-description": "AlignAfterOpenBracket Documentation\n

If true, horizontally aligns arguments after an open bracket.\n

This applies to round brackets (parentheses), angle brackets and square\nbrackets.

From clang-format 3.8

Invoke completion to see all options" }, "AlignArrayOfStructures": { "type": "string", @@ -88,121 +88,258 @@ "description": "Don't align array initializer columns." } }, - "x-intellij-html-description": "

if not ``None``, when using initialization for an array of structs\naligns the fields into columns.\n

NOTE: As of clang-format 15 this option only applied to arrays with equal\nnumber of columns per row.

Documentation\n" + "x-intellij-html-description": "AlignArrayOfStructures Documentation\n

if not None, when using initialization for an array of structs\naligns the fields into columns.\n

Note As of clang-format 15 this option only applied to arrays with equal\n number of columns per row.\n

From clang-format 13

Invoke completion to see all options" }, "AlignConsecutiveAssignments": { "type": "object", "additionalProperties": false, "properties": { - "Enabled": { + "AcrossComments": { "type": "boolean", - "x-intellij-html-description": "

Whether aligning is enabled.\n

.. code-block:: c++\n

#define SHORT_NAME 42\n #define LONGER_NAME 0x007f\n #define EVEN_LONGER_NAME (2)\n #define foo(x) (x * x)\n #define bar(y, z) (y + z)\n

int a = 1;\n int somelongname = 2;\n double c = 3;\n

int aaaa : 1;\n int b : 12;\n int ccc : 8;\n

int aaaa = 12;\n float b = 23;\n std::string ccc;" + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveAssignments Documentation\n" }, "AcrossEmptyLines": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across empty lines.\n

.. code-block:: c++\n

true:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;\n

false:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;" + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveAssignments Documentation\n" }, - "AcrossComments": { + "AlignCompound": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across comments.\n

.. code-block:: c++\n

true:\n int d = 3;\n /* A comment. */\n double e = 4;\n

false:\n int d = 3;\n /* A comment. */\n double e = 4;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveAssignments Documentation\n" }, - "AlignCompound": { + "AlignFunctionPointers": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether compound assignments\nlike ``+=`` are aligned along with ``=``.\n

.. code-block:: c++\n

true:\n a &= 2;\n bbb = 2;\n

false:\n a &= 2;\n bbb = 2;" + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveAssignments Documentation\n" + }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveAssignments Documentation\n" }, "PadOperators": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n

.. code-block:: c++\n

true:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;\n

false:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveAssignments Documentation\n" } }, - "x-intellij-html-description": "

Style of aligning consecutive assignments.\n

``Consecutive`` will result in formattings like:\n

.. code-block:: c++\n

int a = 1;\n int somelongname = 2;\n double c = 3;

Documentation\n" + "x-intellij-html-description": "AlignConsecutiveAssignments Documentation\n

Style of aligning consecutive assignments.\n

Consecutive will result in formattings like:\n\n

  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 3.8" }, "AlignConsecutiveBitFields": { "type": "object", "additionalProperties": false, "properties": { - "Enabled": { + "AcrossComments": { "type": "boolean", - "x-intellij-html-description": "

Whether aligning is enabled.\n

.. code-block:: c++\n

#define SHORT_NAME 42\n #define LONGER_NAME 0x007f\n #define EVEN_LONGER_NAME (2)\n #define foo(x) (x * x)\n #define bar(y, z) (y + z)\n

int a = 1;\n int somelongname = 2;\n double c = 3;\n

int aaaa : 1;\n int b : 12;\n int ccc : 8;\n

int aaaa = 12;\n float b = 23;\n std::string ccc;" + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveBitFields Documentation\n" }, "AcrossEmptyLines": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across empty lines.\n

.. code-block:: c++\n

true:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;\n

false:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;" + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveBitFields Documentation\n" + }, + "AlignCompound": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveBitFields Documentation\n" }, + "AlignFunctionPointers": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveBitFields Documentation\n" + }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveBitFields Documentation\n" + }, + "PadOperators": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveBitFields Documentation\n" + } + }, + "x-intellij-html-description": "AlignConsecutiveBitFields Documentation\n

Style of aligning consecutive bit fields.\n

Consecutive will align the bitfield separators of consecutive lines.\nThis will result in formattings like:\n\n

  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 11" + }, + "AlignConsecutiveDeclarations": { + "type": "object", + "additionalProperties": false, + "properties": { "AcrossComments": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across comments.\n

.. code-block:: c++\n

true:\n int d = 3;\n /* A comment. */\n double e = 4;\n

false:\n int d = 3;\n /* A comment. */\n double e = 4;" + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveDeclarations Documentation\n" + }, + "AcrossEmptyLines": { + "type": "boolean", + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveDeclarations Documentation\n" }, "AlignCompound": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether compound assignments\nlike ``+=`` are aligned along with ``=``.\n

.. code-block:: c++\n

true:\n a &= 2;\n bbb = 2;\n

false:\n a &= 2;\n bbb = 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveDeclarations Documentation\n" + }, + "AlignFunctionPointers": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveDeclarations Documentation\n" + }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveDeclarations Documentation\n" }, "PadOperators": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n

.. code-block:: c++\n

true:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;\n

false:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveDeclarations Documentation\n" } }, - "x-intellij-html-description": "

Style of aligning consecutive bit fields.\n

``Consecutive`` will align the bitfield separators of consecutive lines.\nThis will result in formattings like:\n

.. code-block:: c++\n

int aaaa : 1;\n int b : 12;\n int ccc : 8;

Documentation\n" + "x-intellij-html-description": "AlignConsecutiveDeclarations Documentation\n

Style of aligning consecutive declarations.\n

Consecutive will align the declaration names of consecutive lines.\nThis will result in formattings like:\n\n

  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 3.8" }, - "AlignConsecutiveDeclarations": { + "AlignConsecutiveMacros": { "type": "object", "additionalProperties": false, "properties": { + "AcrossComments": { + "type": "boolean", + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveMacros Documentation\n" + }, + "AcrossEmptyLines": { + "type": "boolean", + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveMacros Documentation\n" + }, + "AlignCompound": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveMacros Documentation\n" + }, + "AlignFunctionPointers": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveMacros Documentation\n" + }, "Enabled": { "type": "boolean", - "x-intellij-html-description": "

Whether aligning is enabled.\n

.. code-block:: c++\n

#define SHORT_NAME 42\n #define LONGER_NAME 0x007f\n #define EVEN_LONGER_NAME (2)\n #define foo(x) (x * x)\n #define bar(y, z) (y + z)\n

int a = 1;\n int somelongname = 2;\n double c = 3;\n

int aaaa : 1;\n int b : 12;\n int ccc : 8;\n

int aaaa = 12;\n float b = 23;\n std::string ccc;" + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveMacros Documentation\n" + }, + "PadOperators": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveMacros Documentation\n" + } + }, + "x-intellij-html-description": "AlignConsecutiveMacros Documentation\n

Style of aligning consecutive macro definitions.\n

Consecutive will result in formattings like:\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 9" + }, + "AlignConsecutiveShortCaseStatements": { + "type": "object", + "additionalProperties": false, + "properties": { + "AcrossComments": { + "type": "boolean", + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  switch (level) {\n  case log::info:    return \"info:\";\n  case log::warning: return \"warning:\";\n  /* A comment. */\n  default:           return \"\";\n  }\n\n  false:\n  switch (level) {\n  case log::info:    return \"info:\";\n  case log::warning: return \"warning:\";\n  /* A comment. */\n  default: return \"\";\n  }\n

AlignConsecutiveShortCaseStatements Documentation\n" }, "AcrossEmptyLines": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across empty lines.\n

.. code-block:: c++\n

true:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;\n

false:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;" + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  switch (level) {\n  case log::info:    return \"info:\";\n  case log::warning: return \"warning:\";\n\n  default:           return \"\";\n  }\n\n  false:\n  switch (level) {\n  case log::info:    return \"info:\";\n  case log::warning: return \"warning:\";\n\n  default: return \"\";\n  }\n

AlignConsecutiveShortCaseStatements Documentation\n" + }, + "AlignCaseArrows": { + "type": "boolean", + "x-intellij-html-description": "Whether to align the case arrows when aligning short case expressions.\n\n

  true:\n  i = switch (day) {\n    case THURSDAY, SATURDAY -> 8;\n    case WEDNESDAY          -> 9;\n    default                 -> 0;\n  };\n\n  false:\n  i = switch (day) {\n    case THURSDAY, SATURDAY -> 8;\n    case WEDNESDAY ->          9;\n    default ->                 0;\n  };\n

AlignConsecutiveShortCaseStatements Documentation\n" + }, + "AlignCaseColons": { + "type": "boolean", + "x-intellij-html-description": "Whether aligned case labels are aligned on the colon, or on the tokens\nafter the colon.\n\n

  true:\n  switch (level) {\n  case log::info   : return \"info:\";\n  case log::warning: return \"warning:\";\n  default          : return \"\";\n  }\n\n  false:\n  switch (level) {\n  case log::info:    return \"info:\";\n  case log::warning: return \"warning:\";\n  default:           return \"\";\n  }\n

AlignConsecutiveShortCaseStatements Documentation\n" }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  true:\n  switch (level) {\n  case log::info:    return \"info:\";\n  case log::warning: return \"warning:\";\n  default:           return \"\";\n  }\n\n  false:\n  switch (level) {\n  case log::info: return \"info:\";\n  case log::warning: return \"warning:\";\n  default: return \"\";\n  }\n

AlignConsecutiveShortCaseStatements Documentation\n" + } + }, + "x-intellij-html-description": "AlignConsecutiveShortCaseStatements Documentation\n

Style of aligning consecutive short case labels.\nOnly applies if AllowShortCaseExpressionOnASingleLine or\nAllowShortCaseLabelsOnASingleLine is true.\n

\n

  # Example of usage:\n  AlignConsecutiveShortCaseStatements:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: true\n    AlignCaseColons: false\n

Alignment options.\n

From clang-format 17" + }, + "AlignConsecutiveTableGenBreakingDAGArgColons": { + "type": "object", + "additionalProperties": false, + "properties": { "AcrossComments": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across comments.\n

.. code-block:: c++\n

true:\n int d = 3;\n /* A comment. */\n double e = 4;\n

false:\n int d = 3;\n /* A comment. */\n double e = 4;" + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n" + }, + "AcrossEmptyLines": { + "type": "boolean", + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n" }, "AlignCompound": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether compound assignments\nlike ``+=`` are aligned along with ``=``.\n

.. code-block:: c++\n

true:\n a &= 2;\n bbb = 2;\n

false:\n a &= 2;\n bbb = 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n" + }, + "AlignFunctionPointers": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n" + }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n" }, "PadOperators": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n

.. code-block:: c++\n

true:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;\n

false:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n" } }, - "x-intellij-html-description": "

Style of aligning consecutive declarations.\n

``Consecutive`` will align the declaration names of consecutive lines.\nThis will result in formattings like:\n

.. code-block:: c++\n

int aaaa = 12;\n float b = 23;\n std::string ccc;

Documentation\n" + "x-intellij-html-description": "AlignConsecutiveTableGenBreakingDAGArgColons Documentation\n

Style of aligning consecutive TableGen DAGArg operator colons.\nIf enabled, align the colon inside DAGArg which have line break inside.\nThis works only when TableGenBreakInsideDAGArg is BreakElements or\nBreakAll and the DAGArg is not excepted by\nTableGenBreakingDAGArgOperators's effect.\n\n

  let dagarg = (ins\n      a  :$src1,\n      aa :$src2,\n      aaa:$src3\n  )\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 19" }, - "AlignConsecutiveMacros": { + "AlignConsecutiveTableGenCondOperatorColons": { "type": "object", "additionalProperties": false, "properties": { - "Enabled": { + "AcrossComments": { "type": "boolean", - "x-intellij-html-description": "

Whether aligning is enabled.\n

.. code-block:: c++\n

#define SHORT_NAME 42\n #define LONGER_NAME 0x007f\n #define EVEN_LONGER_NAME (2)\n #define foo(x) (x * x)\n #define bar(y, z) (y + z)\n

int a = 1;\n int somelongname = 2;\n double c = 3;\n

int aaaa : 1;\n int b : 12;\n int ccc : 8;\n

int aaaa = 12;\n float b = 23;\n std::string ccc;" + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveTableGenCondOperatorColons Documentation\n" }, "AcrossEmptyLines": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across empty lines.\n

.. code-block:: c++\n

true:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;\n

false:\n int a = 1;\n int somelongname = 2;\n double c = 3;\n

int d = 3;" + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveTableGenCondOperatorColons Documentation\n" }, + "AlignCompound": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveTableGenCondOperatorColons Documentation\n" + }, + "AlignFunctionPointers": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveTableGenCondOperatorColons Documentation\n" + }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveTableGenCondOperatorColons Documentation\n" + }, + "PadOperators": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveTableGenCondOperatorColons Documentation\n" + } + }, + "x-intellij-html-description": "AlignConsecutiveTableGenCondOperatorColons Documentation\n

Style of aligning consecutive TableGen cond operator colons.\nAlign the colons of cases inside !cond operators.\n\n

  !cond(!eq(size, 1) : 1,\n        !eq(size, 16): 1,\n        true         : 0)\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 19" + }, + "AlignConsecutiveTableGenDefinitionColons": { + "type": "object", + "additionalProperties": false, + "properties": { "AcrossComments": { "type": "boolean", - "x-intellij-html-description": "

Whether to align across comments.\n

.. code-block:: c++\n

true:\n int d = 3;\n /* A comment. */\n double e = 4;\n

false:\n int d = 3;\n /* A comment. */\n double e = 4;" + "x-intellij-html-description": "Whether to align across comments.\n\n

  true:\n  int d    = 3;\n  /* A comment. */\n  double e = 4;\n\n  false:\n  int d = 3;\n  /* A comment. */\n  double e = 4;\n

AlignConsecutiveTableGenDefinitionColons Documentation\n" + }, + "AcrossEmptyLines": { + "type": "boolean", + "x-intellij-html-description": "Whether to align across empty lines.\n\n

  true:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d            = 3;\n\n  false:\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int d = 3;\n

AlignConsecutiveTableGenDefinitionColons Documentation\n" }, "AlignCompound": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether compound assignments\nlike ``+=`` are aligned along with ``=``.\n

.. code-block:: c++\n

true:\n a &= 2;\n bbb = 2;\n

false:\n a &= 2;\n bbb = 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether compound assignments\nlike += are aligned along with =.\n\n

  true:\n  a   &= 2;\n  bbb  = 2;\n\n  false:\n  a &= 2;\n  bbb = 2;\n

AlignConsecutiveTableGenDefinitionColons Documentation\n" + }, + "AlignFunctionPointers": { + "type": "boolean", + "x-intellij-html-description": "Only for AlignConsecutiveDeclarations. Whether function pointers are\naligned.\n\n

  true:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int      (*f)();\n\n  false:\n  unsigned i;\n  int     &r;\n  int     *p;\n  int (*f)();\n

AlignConsecutiveTableGenDefinitionColons Documentation\n" + }, + "Enabled": { + "type": "boolean", + "x-intellij-html-description": "Whether aligning is enabled.\n\n

  #define SHORT_NAME       42\n  #define LONGER_NAME      0x007f\n  #define EVEN_LONGER_NAME (2)\n  #define foo(x)           (x * x)\n  #define bar(y, z)        (y + z)\n\n  int a            = 1;\n  int somelongname = 2;\n  double c         = 3;\n\n  int aaaa : 1;\n  int b    : 12;\n  int ccc  : 8;\n\n  int         aaaa = 12;\n  float       b = 23;\n  std::string ccc;\n

AlignConsecutiveTableGenDefinitionColons Documentation\n" }, "PadOperators": { "type": "boolean", - "x-intellij-html-description": "

Only for ``AlignConsecutiveAssignments``. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n

.. code-block:: c++\n

true:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;\n

false:\n a >>= 2;\n bbb = 2;\n

a = 2;\n bbb >>= 2;" + "x-intellij-html-description": "Only for AlignConsecutiveAssignments. Whether short assignment\noperators are left-padded to the same length as long ones in order to\nput all assignment operators to the right of the left hand side.\n\n

  true:\n  a   >>= 2;\n  bbb   = 2;\n\n  a     = 2;\n  bbb >>= 2;\n\n  false:\n  a >>= 2;\n  bbb = 2;\n\n  a     = 2;\n  bbb >>= 2;\n

AlignConsecutiveTableGenDefinitionColons Documentation\n" } }, - "x-intellij-html-description": "

Style of aligning consecutive macro definitions.\n

``Consecutive`` will result in formattings like:\n

.. code-block:: c++\n

#define SHORT_NAME 42\n #define LONGER_NAME 0x007f\n #define EVEN_LONGER_NAME (2)\n #define foo(x) (x * x)\n #define bar(y, z) (y + z)

Documentation\n" + "x-intellij-html-description": "AlignConsecutiveTableGenDefinitionColons Documentation\n

Style of aligning consecutive TableGen definition colons.\nThis aligns the inheritance colons of consecutive definitions.\n\n

  def Def       : Parent {}\n  def DefDef    : Parent {}\n  def DefDefDef : Parent {}\n

Alignment options.\n

They can also be read as a whole for compatibility. The choices are:\n- None\n- Consecutive\n- AcrossEmptyLines\n- AcrossComments\n- AcrossEmptyLinesAndComments\n

For example, to align across empty lines and not across comments, either\nof these work.\n\n

  <option-name>: AcrossEmptyLines\n\n  <option-name>:\n    Enabled: true\n    AcrossEmptyLines: true\n    AcrossComments: false\n

From clang-format 19" }, "AlignEscapedNewlines": { "type": "string", "enum": [ "DontAlign", "Left", + "LeftWithLastLine", "Right" ], "x-intellij-enum-metadata": { @@ -212,11 +349,14 @@ "Left": { "description": "Align escaped newlines as far left as possible." }, + "LeftWithLastLine": { + "description": "Align escaped newlines as far left as possible, using the last line of" + }, "Right": { "description": "Align escaped newlines in the right-most column." } }, - "x-intellij-html-description": "

Options for aligning backslashes in escaped newlines.

Documentation\n" + "x-intellij-html-description": "AlignEscapedNewlines Documentation\n

Options for aligning backslashes in escaped newlines.

From clang-format 5

Invoke completion to see all options" }, "AlignOperands": { "type": "string", @@ -236,33 +376,53 @@ "description": "Horizontally align operands of binary and ternary expressions." } }, - "x-intellij-html-description": "

If ``true``, horizontally align operands of binary and ternary\nexpressions.

Documentation\n" + "x-intellij-html-description": "AlignOperands Documentation\n

If true, horizontally align operands of binary and ternary\nexpressions.

From clang-format 3.5

Invoke completion to see all options" }, "AlignTrailingComments": { "type": "object", "additionalProperties": false, "properties": { "Kind": { - "x-intellij-html-description": "

Specifies the way to align trailing comments.\n" + "x-intellij-html-description": "Specifies the way to align trailing comments.\n

AlignTrailingComments Documentation\n" }, "OverEmptyLines": { "type": "number", - "x-intellij-html-description": "

How many empty lines to apply alignment.\nWhen both ``MaxEmptyLinesToKeep`` and ``OverEmptyLines`` are set to 2,\nit formats like below.\n

.. code-block:: c++\n

int a; // all these\n

int ab; // comments are\n

\n int abcdef; // aligned\n

When ``MaxEmptyLinesToKeep`` is set to 2 and ``OverEmptyLines`` is set\nto 1, it formats like below.\n

.. code-block:: c++\n

int a; // these are\n

int ab; // aligned\n

\n int abcdef; // but this isn't" + "x-intellij-html-description": "How many empty lines to apply alignment.\nWhen both MaxEmptyLinesToKeep and OverEmptyLines are set to 2,\nit formats like below.\n\n

  int a;      // all these\n\n  int ab;     // comments are\n\n\n  int abcdef; // aligned\n
\n

When MaxEmptyLinesToKeep is set to 2 and OverEmptyLines is set\nto 1, it formats like below.\n\n

  int a;  // these are\n\n  int ab; // aligned\n\n\n  int abcdef; // but this isn't\n

AlignTrailingComments Documentation\n" } }, - "x-intellij-html-description": "

Control of trailing comments.\n

NOTE: As of clang-format 16 this option is not a bool but can be set\nto the options. Conventional bool options still can be parsed as before.\n

\n.. code-block:: yaml\n

# Example of usage:\n AlignTrailingComments:\n Kind: Always\n OverEmptyLines: 2

Documentation\n" + "x-intellij-html-description": "AlignTrailingComments Documentation\n

Control of trailing comments.\n

The alignment stops at closing braces after a line break, and only\nfollowed by other closing braces, a (do-) while, a lambda call, or\na semicolon.\n

Note As of clang-format 16 this option is not a bool but can be set\n to the options. Conventional bool options still can be parsed as before.\n

\n

  # Example of usage:\n  AlignTrailingComments:\n    Kind: Always\n    OverEmptyLines: 2\n

Alignment options

From clang-format 3.7" }, "AllowAllArgumentsOnNextLine": { "type": "boolean", - "x-intellij-html-description": "

If a function call or braced initializer list doesn't fit on a\nline, allow putting all arguments onto the next line, even if\n``BinPackArguments`` is ``false``.\n

.. code-block:: c++\n

true:\n callFunction(\n a, b, c, d);\n

false:\n callFunction(a,\n b,\n c,\n d);

Documentation\n" + "x-intellij-html-description": "AllowAllArgumentsOnNextLine Documentation\n

If a function call or braced initializer list doesn't fit on a\nline, allow putting all arguments onto the next line, even if\nBinPackArguments is false.\n\n

  true:\n  callFunction(\n      a, b, c, d);\n\n  false:\n  callFunction(a,\n               b,\n               c,\n               d);\n

From clang-format 9" }, "AllowAllConstructorInitializersOnNextLine": { "type": "boolean", - "x-intellij-html-description": "

This option is **deprecated**. See ``NextLine`` of\n``PackConstructorInitializers``.

Documentation\n" + "x-intellij-html-description": "AllowAllConstructorInitializersOnNextLine Documentation\n

This option is **deprecated**. See NextLine of\nPackConstructorInitializers.

From clang-format 9" }, "AllowAllParametersOfDeclarationOnNextLine": { "type": "boolean", - "x-intellij-html-description": "

If the function declaration doesn't fit on a line,\nallow putting all parameters of a function declaration onto\nthe next line even if ``BinPackParameters`` is ``false``.\n

.. code-block:: c++\n

true:\n void myFunction(\n int a, int b, int c, int d, int e);\n

false:\n void myFunction(int a,\n int b,\n int c,\n int d,\n int e);

Documentation\n" + "x-intellij-html-description": "AllowAllParametersOfDeclarationOnNextLine Documentation\n

If the function declaration doesn't fit on a line,\nallow putting all parameters of a function declaration onto\nthe next line even if BinPackParameters is false.\n\n

  true:\n  void myFunction(\n      int a, int b, int c, int d, int e);\n\n  false:\n  void myFunction(int a,\n                  int b,\n                  int c,\n                  int d,\n                  int e);\n

From clang-format 3.3" + }, + "AllowBreakBeforeNoexceptSpecifier": { + "type": "string", + "enum": [ + "Never", + "OnlyWithParen", + "Always" + ], + "x-intellij-enum-metadata": { + "Never": { + "description": "No line break allowed." + }, + "OnlyWithParen": { + "description": "For a simple ``noexcept`` there is no line break allowed, but when we" + }, + "Always": { + "description": "Line breaks are allowed. But note that because of the associated" + } + }, + "x-intellij-html-description": "AllowBreakBeforeNoexceptSpecifier Documentation\n

Controls if there could be a line break before a noexcept specifier.

From clang-format 18

Invoke completion to see all options" }, "AllowShortBlocksOnASingleLine": { "type": "string", @@ -282,15 +442,23 @@ "description": "Always merge short blocks into a single line." } }, - "x-intellij-html-description": "

Dependent on the value, ``while (true) { continue; }`` can be put on a\nsingle line.

Documentation\n" + "x-intellij-html-description": "AllowShortBlocksOnASingleLine Documentation\n

Dependent on the value, while (true) { continue; } can be put on a\nsingle line.

From clang-format 3.5

Invoke completion to see all options" + }, + "AllowShortCaseExpressionOnASingleLine": { + "type": "boolean", + "x-intellij-html-description": "AllowShortCaseExpressionOnASingleLine Documentation\n

Whether to merge a short switch labeled rule into a single line.\n\n

  true:                               false:\n  switch (a) {           vs.          switch (a) {\n  case 1 -> 1;                        case 1 ->\n  default -> 0;                         1;\n  };                                  default ->\n                                        0;\n                                      };\n

From clang-format 19" }, "AllowShortCaseLabelsOnASingleLine": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, short case labels will be contracted to a single line.\n

.. code-block:: c++\n

true: false:\n switch (a) { vs. switch (a) {\n case 1: x = 1; break; case 1:\n case 2: return; x = 1;\n } break;\n case 2:\n return;\n }

Documentation\n" + "x-intellij-html-description": "AllowShortCaseLabelsOnASingleLine Documentation\n

If true, short case labels will be contracted to a single line.\n\n

  true:                                   false:\n  switch (a) {                    vs.     switch (a) {\n  case 1: x = 1; break;                   case 1:\n  case 2: return;                           x = 1;\n  }                                         break;\n                                          case 2:\n                                            return;\n                                          }\n

From clang-format 3.6" + }, + "AllowShortCompoundRequirementOnASingleLine": { + "type": "boolean", + "x-intellij-html-description": "AllowShortCompoundRequirementOnASingleLine Documentation\n

Allow short compound requirement on a single line.\n\n

  true:\n  template <typename T>\n  concept c = requires(T x) {\n    { x + 1 } -> std::same_as<int>;\n  };\n\n  false:\n  template <typename T>\n  concept c = requires(T x) {\n    {\n      x + 1\n    } -> std::same_as<int>;\n  };\n

From clang-format 18" }, "AllowShortEnumsOnASingleLine": { "type": "boolean", - "x-intellij-html-description": "

Allow short enums on a single line.\n

.. code-block:: c++\n

true:\n enum { A, B } myEnum;\n

false:\n enum {\n A,\n B\n } myEnum;

Documentation\n" + "x-intellij-html-description": "AllowShortEnumsOnASingleLine Documentation\n

Allow short enums on a single line.\n\n

  true:\n  enum { A, B } myEnum;\n\n  false:\n  enum {\n    A,\n    B\n  } myEnum;\n

From clang-format 11" }, "AllowShortFunctionsOnASingleLine": { "type": "string", @@ -306,19 +474,19 @@ "description": "Never merge functions into a single line." }, "InlineOnly": { - "description": "Only merge functions defined inside a class. Same as \"inline\"," + "description": "Only merge functions defined inside a class. Same as ``inline``," }, "Empty": { "description": "Only merge empty functions." }, "Inline": { - "description": "Only merge functions defined inside a class. Implies \"empty\"." + "description": "Only merge functions defined inside a class. Implies ``empty``." }, "All": { "description": "Merge all functions fitting on a single line." } }, - "x-intellij-html-description": "

Dependent on the value, ``int f() { return 0; }`` can be put on a\nsingle line.

Documentation\n" + "x-intellij-html-description": "AllowShortFunctionsOnASingleLine Documentation\n

Dependent on the value, int f() { return 0; } can be put on a\nsingle line.

From clang-format 3.5

Invoke completion to see all options" }, "AllowShortIfStatementsOnASingleLine": { "type": "string", @@ -342,7 +510,7 @@ "description": "Always put short ifs, else ifs and else statements on the same" } }, - "x-intellij-html-description": "

Dependent on the value, ``if (a) return;`` can be put on a single line.

Documentation\n" + "x-intellij-html-description": "AllowShortIfStatementsOnASingleLine Documentation\n

Dependent on the value, if (a) return; can be put on a single line.

From clang-format 3.3

Invoke completion to see all options" }, "AllowShortLambdasOnASingleLine": { "type": "string", @@ -366,11 +534,11 @@ "description": "Merge all lambdas fitting on a single line." } }, - "x-intellij-html-description": "

Dependent on the value, ``auto lambda []() { return 0; }`` can be put on a\nsingle line.

Documentation\n" + "x-intellij-html-description": "AllowShortLambdasOnASingleLine Documentation\n

Dependent on the value, auto lambda []() { return 0; } can be put on a\nsingle line.

From clang-format 9

Invoke completion to see all options" }, "AllowShortLoopsOnASingleLine": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, ``while (true) continue;`` can be put on a single\nline.

Documentation\n" + "x-intellij-html-description": "AllowShortLoopsOnASingleLine Documentation\n

If true, while (true) continue; can be put on a single\nline.

From clang-format 3.7" }, "AlwaysBreakAfterDefinitionReturnType": { "type": "string", @@ -390,74 +558,32 @@ "description": "Always break after the return types of top-level functions." } }, - "x-intellij-html-description": "

The function definition return type breaking style to use. This\noption is **deprecated** and is retained for backwards compatibility.

Documentation\n" + "x-intellij-html-description": "AlwaysBreakAfterDefinitionReturnType Documentation\n

The function definition return type breaking style to use. This\noption is **deprecated** and is retained for backwards compatibility.

From clang-format 3.7

Invoke completion to see all options" }, "AlwaysBreakAfterReturnType": { - "type": "string", - "enum": [ - "None", - "All", - "TopLevel", - "AllDefinitions", - "TopLevelDefinitions" - ], - "x-intellij-enum-metadata": { - "None": { - "description": "Break after return type automatically." - }, - "All": { - "description": "Always break after the return type." - }, - "TopLevel": { - "description": "Always break after the return types of top-level functions." - }, - "AllDefinitions": { - "description": "Always break after the return type of function definitions." - }, - "TopLevelDefinitions": { - "description": "Always break after the return type of top-level definitions." - } - }, - "x-intellij-html-description": "

The function declaration return type breaking style to use.

Documentation\n" + "x-intellij-html-description": "AlwaysBreakAfterReturnType Documentation\n

This option is renamed to BreakAfterReturnType.

From clang-format 3.8" }, "AlwaysBreakBeforeMultilineStrings": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, always break before multiline string literals.\n

This flag is mean to make cases where there are multiple multiline strings\nin a file look more consistent. Thus, it will only take effect if wrapping\nthe string at that point leads to it being indented\n``ContinuationIndentWidth`` spaces from the start of the line.\n

.. code-block:: c++\n

true: false:\n aaaa = vs. aaaa = \"bbbb\"\n \"bbbb\" \"cccc\";\n \"cccc\";

Documentation\n" + "x-intellij-html-description": "AlwaysBreakBeforeMultilineStrings Documentation\n

If true, always break before multiline string literals.\n

This flag is mean to make cases where there are multiple multiline strings\nin a file look more consistent. Thus, it will only take effect if wrapping\nthe string at that point leads to it being indented\nContinuationIndentWidth spaces from the start of the line.\n\n

   true:                                  false:\n   aaaa =                         vs.     aaaa = \"bbbb\"\n       \"bbbb\"                                    \"cccc\";\n       \"cccc\";\n

From clang-format 3.4" }, "AlwaysBreakTemplateDeclarations": { - "type": "string", - "enum": [ - "No", - "MultiLine", - "Yes" - ], - "x-intellij-enum-metadata": { - "No": { - "description": "Do not force break before declaration." - }, - "MultiLine": { - "description": "Force break after template declaration only when the following" - }, - "Yes": { - "description": "Always break after template declaration." - } - }, - "x-intellij-html-description": "

The template declaration breaking style to use.

Documentation\n" + "x-intellij-html-description": "AlwaysBreakTemplateDeclarations Documentation\n

This option is renamed to BreakTemplateDeclarations.

From clang-format 3.4" }, "AttributeMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of strings that should be interpreted as attributes/qualifiers\ninstead of identifiers. This can be useful for language extensions or\nstatic analyzer annotations.\n

For example:\n

.. code-block:: c++\n

x = (char *__capability)&y;\n int function(void) __ununsed;\n void only_writes_to_buffer(char *__output buffer);\n

In the .clang-format configuration file, this can be configured like:\n

.. code-block:: yaml\n

AttributeMacros: ['__capability', '__output', '__ununsed']

Documentation\n" + "x-intellij-html-description": "AttributeMacros Documentation\n

A vector of strings that should be interpreted as attributes/qualifiers\ninstead of identifiers. This can be useful for language extensions or\nstatic analyzer annotations.\n

For example:\n\n

  x = (char *__capability)&y;\n  int function(void) __unused;\n  void only_writes_to_buffer(char *__output buffer);\n
\n

In the .clang-format configuration file, this can be configured like:\n\n

  AttributeMacros: [__capability, __output, __unused]\n
\n

From clang-format 12" }, "BinPackArguments": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, a function call's arguments will either be all on the\nsame line or will have one line each.\n

.. code-block:: c++\n

true:\n void f() {\n f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);\n }\n

false:\n void f() {\n f(aaaaaaaaaaaaaaaaaaaa,\n aaaaaaaaaaaaaaaaaaaa,\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);\n }

Documentation\n" + "x-intellij-html-description": "BinPackArguments Documentation\n

If false, a function call's arguments will either be all on the\nsame line or will have one line each.\n\n

  true:\n  void f() {\n    f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,\n      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);\n  }\n\n  false:\n  void f() {\n    f(aaaaaaaaaaaaaaaaaaaa,\n      aaaaaaaaaaaaaaaaaaaa,\n      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);\n  }\n

From clang-format 3.7" }, "BinPackParameters": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, a function declaration's or function definition's\nparameters will either all be on the same line or will have one line each.\n

.. code-block:: c++\n

true:\n void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,\n int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}\n

false:\n void f(int aaaaaaaaaaaaaaaaaaaa,\n int aaaaaaaaaaaaaaaaaaaa,\n int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}

Documentation\n" + "x-intellij-html-description": "BinPackParameters Documentation\n

If false, a function declaration's or function definition's\nparameters will either all be on the same line or will have one line each.\n\n

  true:\n  void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,\n         int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}\n\n  false:\n  void f(int aaaaaaaaaaaaaaaaaaaa,\n         int aaaaaaaaaaaaaaaaaaaa,\n         int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}\n

From clang-format 3.7" }, "BitFieldColonSpacing": { "type": "string", @@ -481,93 +607,159 @@ "description": "Add space after the ``:`` only (space may be added before if" } }, - "x-intellij-html-description": "

The BitFieldColonSpacingStyle to use for bitfields.

Documentation\n" + "x-intellij-html-description": "BitFieldColonSpacing Documentation\n

The BitFieldColonSpacingStyle to use for bitfields.

From clang-format 12

Invoke completion to see all options" }, "BraceWrapping": { "type": "object", "additionalProperties": false, "properties": { + "AfterControlStatement": { + "x-intellij-html-description": "Wrap control statements (if/for/while/switch/..).\n

BraceWrapping Documentation\n" + }, "AfterCaseLabel": { "type": "boolean", - "x-intellij-html-description": "

Wrap case labels.\n

.. code-block:: c++\n

false: true:\n switch (foo) { vs. switch (foo) {\n case 1: { case 1:\n bar(); {\n break; bar();\n } break;\n default: { }\n plop(); default:\n } {\n } plop();\n }\n }" + "x-intellij-html-description": "Wrap case labels.\n\n

  false:                                true:\n  switch (foo) {                vs.     switch (foo) {\n    case 1: {                             case 1:\n      bar();                              {\n      break;                                bar();\n    }                                       break;\n    default: {                            }\n      plop();                             default:\n    }                                     {\n  }                                         plop();\n                                          }\n                                        }\n

BraceWrapping Documentation\n" }, "AfterClass": { "type": "boolean", - "x-intellij-html-description": "

Wrap class definitions.\n

.. code-block:: c++\n

true:\n class foo\n {};\n

false:\n class foo {};" - }, - "AfterControlStatement": { - "x-intellij-html-description": "

Wrap control statements (``if``/``for``/``while``/``switch``/..).\n" + "x-intellij-html-description": "Wrap class definitions.\n\n

  true:\n  class foo\n  {};\n\n  false:\n  class foo {};\n

BraceWrapping Documentation\n" }, "AfterEnum": { "type": "boolean", - "x-intellij-html-description": "

Wrap enum definitions.\n

.. code-block:: c++\n

true:\n enum X : int\n {\n B\n };\n

false:\n enum X : int { B };" + "x-intellij-html-description": "Wrap enum definitions.\n\n

  true:\n  enum X : int\n  {\n    B\n  };\n\n  false:\n  enum X : int { B };\n

BraceWrapping Documentation\n" + }, + "AfterExternBlock": { + "type": "boolean", + "x-intellij-html-description": "Wrap extern blocks.\n\n

  true:\n  extern \"C\"\n  {\n    int foo();\n  }\n\n  false:\n  extern \"C\" {\n  int foo();\n  }\n

BraceWrapping Documentation\n" }, "AfterFunction": { "type": "boolean", - "x-intellij-html-description": "

Wrap function definitions.\n

.. code-block:: c++\n

true:\n void foo()\n {\n bar();\n bar2();\n }\n

false:\n void foo() {\n bar();\n bar2();\n }" + "x-intellij-html-description": "Wrap function definitions.\n\n

  true:\n  void foo()\n  {\n    bar();\n    bar2();\n  }\n\n  false:\n  void foo() {\n    bar();\n    bar2();\n  }\n

BraceWrapping Documentation\n" }, "AfterNamespace": { "type": "boolean", - "x-intellij-html-description": "

Wrap namespace definitions.\n

.. code-block:: c++\n

true:\n namespace\n {\n int foo();\n int bar();\n }\n

false:\n namespace {\n int foo();\n int bar();\n }" + "x-intellij-html-description": "Wrap namespace definitions.\n\n

  true:\n  namespace\n  {\n  int foo();\n  int bar();\n  }\n\n  false:\n  namespace {\n  int foo();\n  int bar();\n  }\n

BraceWrapping Documentation\n" }, "AfterObjCDeclaration": { "type": "boolean", - "x-intellij-html-description": "

Wrap ObjC definitions (interfaces, implementations...).\n@autoreleasepool and @synchronized blocks are wrapped\naccording to `AfterControlStatement` flag." + "x-intellij-html-description": "Wrap ObjC definitions (interfaces, implementations...).\nNote @autoreleasepool and @synchronized blocks are wrapped\n according to AfterControlStatement flag.

BraceWrapping Documentation\n" }, "AfterStruct": { "type": "boolean", - "x-intellij-html-description": "

Wrap struct definitions.\n

.. code-block:: c++\n

true:\n struct foo\n {\n int x;\n };\n

false:\n struct foo {\n int x;\n };" + "x-intellij-html-description": "Wrap struct definitions.\n\n

  true:\n  struct foo\n  {\n    int x;\n  };\n\n  false:\n  struct foo {\n    int x;\n  };\n

BraceWrapping Documentation\n" }, "AfterUnion": { "type": "boolean", - "x-intellij-html-description": "

Wrap union definitions.\n

.. code-block:: c++\n

true:\n union foo\n {\n int x;\n }\n

false:\n union foo {\n int x;\n }" - }, - "AfterExternBlock": { - "type": "boolean", - "x-intellij-html-description": "

Wrap extern blocks.\n

.. code-block:: c++\n

true:\n extern \"C\"\n {\n int foo();\n }\n

false:\n extern \"C\" {\n int foo();\n }" + "x-intellij-html-description": "Wrap union definitions.\n\n

  true:\n  union foo\n  {\n    int x;\n  }\n\n  false:\n  union foo {\n    int x;\n  }\n

BraceWrapping Documentation\n" }, "BeforeCatch": { "type": "boolean", - "x-intellij-html-description": "

Wrap before ``catch``.\n

.. code-block:: c++\n

true:\n try {\n foo();\n }\n catch () {\n }\n

false:\n try {\n foo();\n } catch () {\n }" + "x-intellij-html-description": "Wrap before catch.\n\n

  true:\n  try {\n    foo();\n  }\n  catch () {\n  }\n\n  false:\n  try {\n    foo();\n  } catch () {\n  }\n

BraceWrapping Documentation\n" }, "BeforeElse": { "type": "boolean", - "x-intellij-html-description": "

Wrap before ``else``.\n

.. code-block:: c++\n

true:\n if (foo()) {\n }\n else {\n }\n

false:\n if (foo()) {\n } else {\n }" + "x-intellij-html-description": "Wrap before else.\n\n

  true:\n  if (foo()) {\n  }\n  else {\n  }\n\n  false:\n  if (foo()) {\n  } else {\n  }\n

BraceWrapping Documentation\n" }, "BeforeLambdaBody": { "type": "boolean", - "x-intellij-html-description": "

Wrap lambda block.\n

.. code-block:: c++\n

true:\n connect(\n []()\n {\n foo();\n bar();\n });\n

false:\n connect([]() {\n foo();\n bar();\n });" + "x-intellij-html-description": "Wrap lambda block.\n\n

  true:\n  connect(\n    []()\n    {\n      foo();\n      bar();\n    });\n\n  false:\n  connect([]() {\n    foo();\n    bar();\n  });\n

BraceWrapping Documentation\n" }, "BeforeWhile": { "type": "boolean", - "x-intellij-html-description": "

Wrap before ``while``.\n

.. code-block:: c++\n

true:\n do {\n foo();\n }\n while (1);\n

false:\n do {\n foo();\n } while (1);" + "x-intellij-html-description": "Wrap before while.\n\n

  true:\n  do {\n    foo();\n  }\n  while (1);\n\n  false:\n  do {\n    foo();\n  } while (1);\n

BraceWrapping Documentation\n" }, "IndentBraces": { "type": "boolean", - "x-intellij-html-description": "

Indent the wrapped braces themselves." + "x-intellij-html-description": "Indent the wrapped braces themselves.

BraceWrapping Documentation\n" }, "SplitEmptyFunction": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, empty function body can be put on a single line.\nThis option is used only if the opening brace of the function has\nalready been wrapped, i.e. the `AfterFunction` brace wrapping mode is\nset, and the function could/should not be put on a single line (as per\n`AllowShortFunctionsOnASingleLine` and constructor formatting options).\n

.. code-block:: c++\n

false: true:\n int f() vs. int f()\n {} {\n }" + "x-intellij-html-description": "If false, empty function body can be put on a single line.\nThis option is used only if the opening brace of the function has\nalready been wrapped, i.e. the AfterFunction brace wrapping mode is\nset, and the function could/should not be put on a single line (as per\nAllowShortFunctionsOnASingleLine and constructor formatting\noptions).\n\n

  false:          true:\n  int f()   vs.   int f()\n  {}              {\n                  }\n
\n

BraceWrapping Documentation\n" }, - "SplitEmptyRecord": { + "SplitEmptyNamespace": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, empty record (e.g. class, struct or union) body\ncan be put on a single line. This option is used only if the opening\nbrace of the record has already been wrapped, i.e. the `AfterClass`\n(for classes) brace wrapping mode is set.\n

.. code-block:: c++\n

false: true:\n class Foo vs. class Foo\n {} {\n }" + "x-intellij-html-description": "If false, empty namespace body can be put on a single line.\nThis option is used only if the opening brace of the namespace has\nalready been wrapped, i.e. the AfterNamespace brace wrapping mode is\nset.\n\n

  false:               true:\n  namespace Foo   vs.  namespace Foo\n  {}                   {\n                       }\n
\n

BraceWrapping Documentation\n" }, - "SplitEmptyNamespace": { + "SplitEmptyRecord": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, empty namespace body can be put on a single line.\nThis option is used only if the opening brace of the namespace has\nalready been wrapped, i.e. the `AfterNamespace` brace wrapping mode is\nset.\n

.. code-block:: c++\n

false: true:\n namespace Foo vs. namespace Foo\n {} {\n }" + "x-intellij-html-description": "If false, empty record (e.g. class, struct or union) body\ncan be put on a single line. This option is used only if the opening\nbrace of the record has already been wrapped, i.e. the AfterClass\n(for classes) brace wrapping mode is set.\n\n

  false:           true:\n  class Foo   vs.  class Foo\n  {}               {\n                   }\n
\n

BraceWrapping Documentation\n" + } + }, + "x-intellij-html-description": "BraceWrapping Documentation\n

Control of individual brace wrapping cases.\n

If BreakBeforeBraces is set to BS_Custom, use this to specify how\neach individual brace case should be handled. Otherwise, this is ignored.\n\n

  # Example of usage:\n  BreakBeforeBraces: Custom\n  BraceWrapping:\n    AfterEnum: true\n    AfterStruct: false\n    SplitEmptyFunction: false\n

Precise control over the wrapping of braces.\n\n

  # Should be declared this way:\n  BreakBeforeBraces: Custom\n  BraceWrapping:\n      AfterClass: true\n

From clang-format 3.8" + }, + "BracedInitializerIndentWidth": { + "type": { + "type": "number" + }, + "x-intellij-html-description": "BracedInitializerIndentWidth Documentation\n

The number of columns to use to indent the contents of braced init lists.\nIf unset, ContinuationIndentWidth is used.\n\n

  AlignAfterOpenBracket: AlwaysBreak\n  BracedInitializerIndentWidth: 2\n\n  void f() {\n    SomeClass c{\n      \"foo\",\n      \"bar\",\n      \"baz\",\n    };\n    auto s = SomeStruct{\n      .foo = \"foo\",\n      .bar = \"bar\",\n      .baz = \"baz\",\n    };\n    SomeArrayT a[3] = {\n      {\n        foo,\n        bar,\n      },\n      {\n        foo,\n        bar,\n      },\n      SomeArrayT{},\n    };\n  }\n

From clang-format 17" + }, + "BreakAdjacentStringLiterals": { + "type": "boolean", + "x-intellij-html-description": "BreakAdjacentStringLiterals Documentation\n

Break between adjacent string literals.\n\n

   true:\n   return \"Code\"\n          \"\\0\\52\\26\\55\\55\\0\"\n          \"x013\"\n          \"\\02\\xBA\";\n   false:\n   return \"Code\" \"\\0\\52\\26\\55\\55\\0\" \"x013\" \"\\02\\xBA\";\n

From clang-format 18" + }, + "BreakAfterAttributes": { + "type": "string", + "enum": [ + "Always", + "Leave", + "Never" + ], + "x-intellij-enum-metadata": { + "Always": { + "description": "Always break after attributes." + }, + "Leave": { + "description": "Leave the line breaking after attributes as is." + }, + "Never": { + "description": "Never break after attributes." } }, - "x-intellij-html-description": "

Control of individual brace wrapping cases.\n

If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how\neach individual brace case should be handled. Otherwise, this is ignored.\n

.. code-block:: yaml\n

# Example of usage:\n BreakBeforeBraces: Custom\n BraceWrapping:\n AfterEnum: true\n AfterStruct: false\n SplitEmptyFunction: false

Documentation\n" + "x-intellij-html-description": "BreakAfterAttributes Documentation\n

Break after a group of C++11 attributes before variable or function\n(including constructor/destructor) declaration/definition names or before\ncontrol statements, i.e. if, switch (including case and\ndefault labels), for, and while statements.

From clang-format 16

Invoke completion to see all options" }, "BreakAfterJavaFieldAnnotations": { "type": "boolean", - "x-intellij-html-description": "

Break after each annotation on a field in Java files.\n

.. code-block:: java\n

true: false:\n @Partial vs. @Partial @Mock DataLoad loader;\n @Mock\n DataLoad loader;

Documentation\n" + "x-intellij-html-description": "BreakAfterJavaFieldAnnotations Documentation\n

Break after each annotation on a field in Java files.\n\n

   true:                                  false:\n   @Partial                       vs.     @Partial @Mock DataLoad loader;\n   @Mock\n   DataLoad loader;\n

From clang-format 3.8" + }, + "BreakAfterReturnType": { + "type": "string", + "enum": [ + "None", + "Automatic", + "ExceptShortType", + "All", + "TopLevel", + "AllDefinitions", + "TopLevelDefinitions" + ], + "x-intellij-enum-metadata": { + "None": { + "description": "This is **deprecated**. See ``Automatic`` below." + }, + "Automatic": { + "description": "Break after return type based on ``PenaltyReturnTypeOnItsOwnLine``." + }, + "ExceptShortType": { + "description": "Same as ``Automatic`` above, except that there is no break after short" + }, + "All": { + "description": "Always break after the return type." + }, + "TopLevel": { + "description": "Always break after the return types of top-level functions." + }, + "AllDefinitions": { + "description": "Always break after the return type of function definitions." + }, + "TopLevelDefinitions": { + "description": "Always break after the return type of top-level definitions." + } + }, + "x-intellij-html-description": "BreakAfterReturnType Documentation\n

The function declaration return type breaking style to use.

From clang-format 19

Invoke completion to see all options" }, "BreakArrays": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, clang-format will always break after a Json array `[`\notherwise it will scan until the closing `]` to determine if it should add\nnewlines between elements (prettier compatible).\n

NOTE: This is currently only for formatting JSON.\n

.. code-block:: c++\n

true: false:\n [ vs. [1, 2, 3, 4]\n 1,\n 2,\n 3,\n 4\n ]

Documentation\n" + "x-intellij-html-description": "BreakArrays Documentation\n

If true, clang-format will always break after a Json array [\notherwise it will scan until the closing ] to determine if it should\nadd newlines between elements (prettier compatible).\n

Note This is currently only for formatting JSON.\n\n

   true:                                  false:\n   [                          vs.      [1, 2, 3, 4]\n     1,\n     2,\n     3,\n     4\n   ]\n

From clang-format 16" }, "BreakBeforeBinaryOperators": { "type": "string", @@ -587,7 +779,7 @@ "description": "Break before operators." } }, - "x-intellij-html-description": "

The way to wrap binary operators.

Documentation\n" + "x-intellij-html-description": "BreakBeforeBinaryOperators Documentation\n

The way to wrap binary operators.

From clang-format 3.6

Invoke completion to see all options" }, "BreakBeforeBraces": { "type": "string", @@ -628,10 +820,10 @@ "description": "Like ``Attach``, but break before functions." }, "Custom": { - "description": "Configure each individual brace in `BraceWrapping`." + "description": "Configure each individual brace in ``BraceWrapping``." } }, - "x-intellij-html-description": "

The brace breaking style to use.

Documentation\n" + "x-intellij-html-description": "BreakBeforeBraces Documentation\n

The brace breaking style to use.

From clang-format 3.7

Invoke completion to see all options" }, "BreakBeforeConceptDeclarations": { "type": "string", @@ -651,7 +843,7 @@ "description": "Always break before ``concept``, putting it in the line after the" } }, - "x-intellij-html-description": "

The concept declaration style to use.

Documentation\n" + "x-intellij-html-description": "BreakBeforeConceptDeclarations Documentation\n

The concept declaration style to use.

From clang-format 12

Invoke completion to see all options" }, "BreakBeforeInlineASMColon": { "type": "string", @@ -671,11 +863,11 @@ "description": "Always break before inline ASM colon." } }, - "x-intellij-html-description": "

The inline ASM colon style to use.

Documentation\n" + "x-intellij-html-description": "BreakBeforeInlineASMColon Documentation\n

The inline ASM colon style to use.

From clang-format 16

Invoke completion to see all options" }, "BreakBeforeTernaryOperators": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, ternary operators will be placed after line breaks.\n

.. code-block:: c++\n

true:\n veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription\n ? firstValue\n : SecondValueVeryVeryVeryVeryLong;\n

false:\n veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?\n firstValue :\n SecondValueVeryVeryVeryVeryLong;

Documentation\n" + "x-intellij-html-description": "BreakBeforeTernaryOperators Documentation\n

If true, ternary operators will be placed after line breaks.\n\n

   true:\n   veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription\n       ? firstValue\n       : SecondValueVeryVeryVeryVeryLong;\n\n   false:\n   veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?\n       firstValue :\n       SecondValueVeryVeryVeryVeryLong;\n

From clang-format 3.7" }, "BreakConstructorInitializers": { "type": "string", @@ -695,7 +887,11 @@ "description": "Break constructor initializers after the colon and commas." } }, - "x-intellij-html-description": "

The break constructor initializers style to use.

Documentation\n" + "x-intellij-html-description": "BreakConstructorInitializers Documentation\n

The break constructor initializers style to use.

From clang-format 5

Invoke completion to see all options" + }, + "BreakFunctionDefinitionParameters": { + "type": "boolean", + "x-intellij-html-description": "BreakFunctionDefinitionParameters Documentation\n

If true, clang-format will always break before function definition\nparameters.\n\n

   true:\n   void functionDefinition(\n            int A, int B) {}\n\n   false:\n   void functionDefinition(int A, int B) {}\n\n

From clang-format 19" }, "BreakInheritanceList": { "type": "string", @@ -719,51 +915,75 @@ "description": "Break inheritance list only after the commas." } }, - "x-intellij-html-description": "

The inheritance list style to use.

Documentation\n" + "x-intellij-html-description": "BreakInheritanceList Documentation\n

The inheritance list style to use.

From clang-format 7

Invoke completion to see all options" }, "BreakStringLiterals": { "type": "boolean", - "x-intellij-html-description": "

Allow breaking string literals when formatting.\n

.. code-block:: c++\n

true:\n const char* x = \"veryVeryVeryVeryVeryVe\"\n \"ryVeryVeryVeryVeryVery\"\n \"VeryLongString\";\n

false:\n const char* x =\n \"veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\";

Documentation\n" + "x-intellij-html-description": "BreakStringLiterals Documentation\n

Allow breaking string literals when formatting.\n

In C, C++, and Objective-C:\n\n

   true:\n   const char* x = \"veryVeryVeryVeryVeryVe\"\n                   \"ryVeryVeryVeryVeryVery\"\n                   \"VeryLongString\";\n\n   false:\n   const char* x =\n       \"veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\";\n
\n

In C# and Java:\n\n

   true:\n   string x = \"veryVeryVeryVeryVeryVe\" +\n              \"ryVeryVeryVeryVeryVery\" +\n              \"VeryLongString\";\n\n   false:\n   string x =\n       \"veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\";\n
\n

C# interpolated strings are not broken.\n

In Verilog:\n\n

   true:\n   string x = {\"veryVeryVeryVeryVeryVe\",\n               \"ryVeryVeryVeryVeryVery\",\n               \"VeryLongString\"};\n\n   false:\n   string x =\n       \"veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\";\n
\n

From clang-format 3.9" + }, + "BreakTemplateDeclarations": { + "type": "string", + "enum": [ + "Leave", + "No", + "MultiLine", + "Yes" + ], + "x-intellij-enum-metadata": { + "Leave": { + "description": "Do not change the line breaking before the declaration." + }, + "No": { + "description": "Do not force break before declaration." + }, + "MultiLine": { + "description": "Force break after template declaration only when the following" + }, + "Yes": { + "description": "Always break after template declaration." + } + }, + "x-intellij-html-description": "BreakTemplateDeclarations Documentation\n

The template declaration breaking style to use.

From clang-format 19

Invoke completion to see all options" }, "ColumnLimit": { "type": "number", - "x-intellij-html-description": "

The column limit.\n

A column limit of ``0`` means that there is no column limit. In this case,\nclang-format will respect the input's line breaking decisions within\nstatements unless they contradict other rules.

Documentation\n" + "x-intellij-html-description": "ColumnLimit Documentation\n

The column limit.\n

A column limit of 0 means that there is no column limit. In this case,\nclang-format will respect the input's line breaking decisions within\nstatements unless they contradict other rules.

From clang-format 3.7" }, "CommentPragmas": { "type": "string", - "x-intellij-html-description": "

A regular expression that describes comments with special meaning,\nwhich should not be split into lines or otherwise changed.\n

.. code-block:: c++\n

// CommentPragmas: '^ FOOBAR pragma:'\n // Will leave the following line unaffected\n #include // FOOBAR pragma: keep

Documentation\n" + "x-intellij-html-description": "CommentPragmas Documentation\n

A regular expression that describes comments with special meaning,\nwhich should not be split into lines or otherwise changed.\n\n

   // CommentPragmas: '^ FOOBAR pragma:'\n   // Will leave the following line unaffected\n   #include <vector> // FOOBAR pragma: keep\n

From clang-format 3.7" }, "CompactNamespaces": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, consecutive namespace declarations will be on the same\nline. If ``false``, each namespace is declared on a new line.\n

.. code-block:: c++\n

true:\n namespace Foo { namespace Bar {\n }}\n

false:\n namespace Foo {\n namespace Bar {\n }\n }\n

If it does not fit on a single line, the overflowing namespaces get\nwrapped:\n

.. code-block:: c++\n

namespace Foo { namespace Bar {\n namespace Extra {\n }}}

Documentation\n" + "x-intellij-html-description": "CompactNamespaces Documentation\n

If true, consecutive namespace declarations will be on the same\nline. If false, each namespace is declared on a new line.\n\n

  true:\n  namespace Foo { namespace Bar {\n  }}\n\n  false:\n  namespace Foo {\n  namespace Bar {\n  }\n  }\n
\n

If it does not fit on a single line, the overflowing namespaces get\nwrapped:\n\n

  namespace Foo { namespace Bar {\n  namespace Extra {\n  }}}\n

From clang-format 5" }, "ConstructorInitializerAllOnOneLineOrOnePerLine": { "type": "boolean", - "x-intellij-html-description": "

This option is **deprecated**. See ``CurrentLine`` of\n``PackConstructorInitializers``.

Documentation\n" + "x-intellij-html-description": "ConstructorInitializerAllOnOneLineOrOnePerLine Documentation\n

This option is **deprecated**. See CurrentLine of\nPackConstructorInitializers.

From clang-format 3.7" }, "ConstructorInitializerIndentWidth": { "type": "number", - "x-intellij-html-description": "

The number of characters to use for indentation of constructor\ninitializer lists as well as inheritance lists.

Documentation\n" + "x-intellij-html-description": "ConstructorInitializerIndentWidth Documentation\n

The number of characters to use for indentation of constructor\ninitializer lists as well as inheritance lists.

From clang-format 3.7" }, "ContinuationIndentWidth": { "type": "number", - "x-intellij-html-description": "

Indent width for line continuations.\n

.. code-block:: c++\n

ContinuationIndentWidth: 2\n

int i = // VeryVeryVeryVeryVeryLongComment\n longFunction( // Again a long comment\n arg);

Documentation\n" + "x-intellij-html-description": "ContinuationIndentWidth Documentation\n

Indent width for line continuations.\n\n

   ContinuationIndentWidth: 2\n\n   int i =         //  VeryVeryVeryVeryVeryLongComment\n     longFunction( // Again a long comment\n       arg);\n

From clang-format 3.7" }, "Cpp11BracedListStyle": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, format braced lists as best suited for C++11 braced\nlists.\n

Important differences:\n- No spaces inside the braced list.\n- No line break before the closing brace.\n- Indentation with the continuation indent, not with the block indent.\n

Fundamentally, C++11 braced lists are formatted exactly like function\ncalls would be formatted in their place. If the braced list follows a name\n(e.g. a type or variable name), clang-format formats as if the ``{}`` were\nthe parentheses of a function call with that name. If there is no name,\na zero-length name is assumed.\n

.. code-block:: c++\n

true: false:\n vector x{1, 2, 3, 4}; vs. vector x{ 1, 2, 3, 4 };\n vector x{{}, {}, {}, {}}; vector x{ {}, {}, {}, {} };\n f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);\n new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };

Documentation\n" + "x-intellij-html-description": "Cpp11BracedListStyle Documentation\n

If true, format braced lists as best suited for C++11 braced\nlists.\n

Important differences:\n- No spaces inside the braced list.\n- No line break before the closing brace.\n- Indentation with the continuation indent, not with the block indent.\n

Fundamentally, C++11 braced lists are formatted exactly like function\ncalls would be formatted in their place. If the braced list follows a name\n(e.g. a type or variable name), clang-format formats as if the {} were\nthe parentheses of a function call with that name. If there is no name,\na zero-length name is assumed.\n\n

   true:                                  false:\n   vector<int> x{1, 2, 3, 4};     vs.     vector<int> x{ 1, 2, 3, 4 };\n   vector<T> x{{}, {}, {}, {}};           vector<T> x{ {}, {}, {}, {} };\n   f(MyMap[{composite, key}]);            f(MyMap[{ composite, key }]);\n   new int[3]{1, 2, 3};                   new int[3]{ 1, 2, 3 };\n

From clang-format 3.4" }, "DeriveLineEnding": { "type": "boolean", - "x-intellij-html-description": "

Analyze the formatted file for the most used line ending (``\\r\\n``\nor ``\\n``). ``UseCRLF`` is only used as a fallback if none can be derived.

Documentation\n" + "x-intellij-html-description": "DeriveLineEnding Documentation\n

This option is **deprecated**. See DeriveLF and DeriveCRLF of\nLineEnding.

From clang-format 10" }, "DerivePointerAlignment": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, analyze the formatted file for the most common\nalignment of ``&`` and ``*``.\nPointer and reference alignment styles are going to be updated according\nto the preferences found in the file.\n``PointerAlignment`` is then used only as fallback.

Documentation\n" + "x-intellij-html-description": "DerivePointerAlignment Documentation\n

If true, analyze the formatted file for the most common\nalignment of & and *.\nPointer and reference alignment styles are going to be updated according\nto the preferences found in the file.\nPointerAlignment is then used only as fallback.

From clang-format 3.7" }, "DisableFormat": { "type": "boolean", - "x-intellij-html-description": "

Disables formatting completely.

Documentation\n" + "x-intellij-html-description": "DisableFormat Documentation\n

Disables formatting completely.

From clang-format 3.7" }, "EmptyLineAfterAccessModifier": { "type": "string", @@ -783,7 +1003,7 @@ "description": "Always add empty line after access modifiers if there are none." } }, - "x-intellij-html-description": "

Defines when to put an empty line after access modifiers.\n``EmptyLineBeforeAccessModifier`` configuration handles the number of\nempty lines between two access modifiers.

Documentation\n" + "x-intellij-html-description": "EmptyLineAfterAccessModifier Documentation\n

Defines when to put an empty line after access modifiers.\nEmptyLineBeforeAccessModifier configuration handles the number of\nempty lines between two access modifiers.

From clang-format 13

Invoke completion to see all options" }, "EmptyLineBeforeAccessModifier": { "type": "string", @@ -807,29 +1027,29 @@ "description": "Always add empty line before access modifiers unless access modifier" } }, - "x-intellij-html-description": "

Defines in which cases to put empty line before access modifiers.

Documentation\n" + "x-intellij-html-description": "EmptyLineBeforeAccessModifier Documentation\n

Defines in which cases to put empty line before access modifiers.

From clang-format 12

Invoke completion to see all options" }, "ExperimentalAutoDetectBinPacking": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, clang-format detects whether function calls and\ndefinitions are formatted with one parameter per line.\n

Each call can be bin-packed, one-per-line or inconclusive. If it is\ninconclusive, e.g. completely on one line, but a decision needs to be\nmade, clang-format analyzes whether there are other bin-packed cases in\nthe input file and act accordingly.\n

NOTE: This is an experimental flag, that might go away or be renamed. Do\nnot use this in config files, etc. Use at your own risk.

Documentation\n" + "x-intellij-html-description": "ExperimentalAutoDetectBinPacking Documentation\n

If true, clang-format detects whether function calls and\ndefinitions are formatted with one parameter per line.\n

Each call can be bin-packed, one-per-line or inconclusive. If it is\ninconclusive, e.g. completely on one line, but a decision needs to be\nmade, clang-format analyzes whether there are other bin-packed cases in\nthe input file and act accordingly.\n

Note This is an experimental flag, that might go away or be renamed. Do\n not use this in config files, etc. Use at your own risk.

From clang-format 3.7" }, "FixNamespaceComments": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, clang-format adds missing namespace end comments for\nnamespaces and fixes invalid existing ones. This doesn't affect short\nnamespaces, which are controlled by ``ShortNamespaceLines``.\n

.. code-block:: c++\n

true: false:\n namespace longNamespace { vs. namespace longNamespace {\n void foo(); void foo();\n void bar(); void bar();\n } // namespace a }\n namespace shortNamespace { namespace shortNamespace {\n void baz(); void baz();\n } }

Documentation\n" + "x-intellij-html-description": "FixNamespaceComments Documentation\n

If true, clang-format adds missing namespace end comments for\nnamespaces and fixes invalid existing ones. This doesn't affect short\nnamespaces, which are controlled by ShortNamespaceLines.\n\n

   true:                                  false:\n   namespace longNamespace {      vs.     namespace longNamespace {\n   void foo();                            void foo();\n   void bar();                            void bar();\n   } // namespace a                       }\n   namespace shortNamespace {             namespace shortNamespace {\n   void baz();                            void baz();\n   }                                      }\n

From clang-format 5" }, "ForEachMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of macros that should be interpreted as foreach loops\ninstead of as function calls.\n

These are expected to be macros of the form:\n

.. code-block:: c++\n

FOREACH(, ...)\n \n

In the .clang-format configuration file, this can be configured like:\n

.. code-block:: yaml\n

ForEachMacros: ['RANGES_FOR', 'FOREACH']\n

For example: BOOST_FOREACH.

Documentation\n" + "x-intellij-html-description": "ForEachMacros Documentation\n

A vector of macros that should be interpreted as foreach loops\ninstead of as function calls.\n

These are expected to be macros of the form:\n\n

  FOREACH(<variable-declaration>, ...)\n    <loop-body>\n
\n

In the .clang-format configuration file, this can be configured like:\n\n

  ForEachMacros: [RANGES_FOR, FOREACH]\n
\n

For example: BOOST_FOREACH.

From clang-format 3.7" }, "IfMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of macros that should be interpreted as conditionals\ninstead of as function calls.\n

These are expected to be macros of the form:\n

.. code-block:: c++\n

IF(...)\n \n else IF(...)\n \n

In the .clang-format configuration file, this can be configured like:\n

.. code-block:: yaml\n

IfMacros: ['IF']\n

For example: `KJ_IF_MAYBE\n`_

Documentation\n" + "x-intellij-html-description": "IfMacros Documentation\n

A vector of macros that should be interpreted as conditionals\ninstead of as function calls.\n

These are expected to be macros of the form:\n\n

  IF(...)\n    <conditional-body>\n  else IF(...)\n    <conditional-body>\n
\n

In the .clang-format configuration file, this can be configured like:\n\n

  IfMacros: [IF]\n
\n

For example: KJ_IF_MAYBE\n

From clang-format 13" }, "IncludeBlocks": { "type": "string", @@ -849,48 +1069,53 @@ "description": "Merge multiple ``#include`` blocks together and sort as one." } }, - "x-intellij-html-description": "

Dependent on the value, multiple ``#include`` blocks can be sorted\nas one and divided based on category.

Documentation\n" + "x-intellij-html-description": "IncludeBlocks Documentation\n

Dependent on the value, multiple #include blocks can be sorted\nas one and divided based on category.

From clang-format 6

Invoke completion to see all options" }, "IncludeCategories": { "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { - "Regex": { - "type": "string" + "RegexIsCaseSensitive": { + "type": "boolean", + "x-intellij-html-description": "If the regular expression is case sensitive.

IncludeCategories Documentation\n" }, "Priority": { - "type": "integer" + "type": "number", + "x-intellij-html-description": "The priority to assign to this category.

IncludeCategories Documentation\n" }, "SortPriority": { - "type": "integer" + "type": "number", + "x-intellij-html-description": "The custom priority to sort before grouping.

IncludeCategories Documentation\n" }, - "CaseSensitive": { - "type": "boolean" + "Regex": { + "type": "string", + "x-intellij-html-description": "The regular expression that this category matches.

IncludeCategories Documentation\n" } } }, - "x-intellij-html-description": "

Regular expressions denoting the different ``#include`` categories\nused for ordering ``#includes``.\n

`POSIX extended\n`_\nregular expressions are supported.\n

These regular expressions are matched against the filename of an include\n(including the <> or \"\") in order. The value belonging to the first\nmatching regular expression is assigned and ``#includes`` are sorted first\naccording to increasing category number and then alphabetically within\neach category.\n

If none of the regular expressions match, INT_MAX is assigned as\ncategory. The main header for a source file automatically gets category 0.\nso that it is generally kept at the beginning of the ``#includes``\n(https://llvm.org/docs/CodingStandards.html#include-style). However, you\ncan also assign negative priorities if you have certain headers that\nalways need to be first.\n

There is a third and optional field ``SortPriority`` which can used while\n``IncludeBlocks = IBS_Regroup`` to define the priority in which\n``#includes`` should be ordered. The value of ``Priority`` defines the\norder of ``#include blocks`` and also allows the grouping of ``#includes``\nof different priority. ``SortPriority`` is set to the value of\n``Priority`` as default if it is not assigned.\n

Each regular expression can be marked as case sensitive with the field\n``CaseSensitive``, per default it is not.\n

To configure this in the .clang-format file, use:\n

.. code-block:: yaml\n

IncludeCategories:\n - Regex: '^\"(llvm|llvm-c|clang|clang-c)/'\n Priority: 2\n SortPriority: 2\n CaseSensitive: true\n - Regex: '^((<|\")(gtest|gmock|isl|json)/)'\n Priority: 3\n - Regex: '<[[:alnum:].]+>'\n Priority: 4\n - Regex: '.*'\n Priority: 1\n SortPriority: 0

Documentation\n" + "x-intellij-html-description": "IncludeCategories Documentation\n

Regular expressions denoting the different #include categories\nused for ordering #includes.\n

POSIX extended\n\nregular expressions are supported.\n

These regular expressions are matched against the filename of an include\n(including the <> or \"\") in order. The value belonging to the first\nmatching regular expression is assigned and #includes are sorted first\naccording to increasing category number and then alphabetically within\neach category.\n

If none of the regular expressions match, INT_MAX is assigned as\ncategory. The main header for a source file automatically gets category 0.\nso that it is generally kept at the beginning of the #includes\n(https://llvm.org/docs/CodingStandards.html#include-style). However, you\ncan also assign negative priorities if you have certain headers that\nalways need to be first.\n

There is a third and optional field SortPriority which can used while\nIncludeBlocks = IBS_Regroup to define the priority in which\n#includes should be ordered. The value of Priority defines the\norder of #include blocks and also allows the grouping of #includes\nof different priority. SortPriority is set to the value of\nPriority as default if it is not assigned.\n

Each regular expression can be marked as case sensitive with the field\nCaseSensitive, per default it is not.\n

To configure this in the .clang-format file, use:\n\n

  IncludeCategories:\n    - Regex:           '^\"(llvm|llvm-c|clang|clang-c)/'\n      Priority:        2\n      SortPriority:    2\n      CaseSensitive:   true\n    - Regex:           '^((<|\")(gtest|gmock|isl|json)/)'\n      Priority:        3\n    - Regex:           '<[[:alnum:].]+>'\n      Priority:        4\n    - Regex:           '.*'\n      Priority:        1\n      SortPriority:    0\n

From clang-format 3.8" }, "IncludeIsMainRegex": { "type": "string", - "x-intellij-html-description": "

Specify a regular expression of suffixes that are allowed in the\nfile-to-main-include mapping.\n

When guessing whether a #include is the \"main\" include (to assign\ncategory 0, see above), use this regex of allowed suffixes to the header\nstem. A partial match is done, so that:\n- \"\" means \"arbitrary suffix\"\n- \"$\" means \"no suffix\"\n

For example, if configured to \"(_test)?$\", then a header a.h would be seen\nas the \"main\" include in both a.cc and a_test.cc.

Documentation\n" + "x-intellij-html-description": "IncludeIsMainRegex Documentation\n

Specify a regular expression of suffixes that are allowed in the\nfile-to-main-include mapping.\n

When guessing whether a #include is the \"main\" include (to assign\ncategory 0, see above), use this regex of allowed suffixes to the header\nstem. A partial match is done, so that:\n- \"\" means \"arbitrary suffix\"\n- \"$\" means \"no suffix\"\n

For example, if configured to \"(_test)?$\", then a header a.h would be seen\nas the \"main\" include in both a.cc and a_test.cc.

From clang-format 3.9" }, "IncludeIsMainSourceRegex": { "type": "string", - "x-intellij-html-description": "

Specify a regular expression for files being formatted\nthat are allowed to be considered \"main\" in the\nfile-to-main-include mapping.\n

By default, clang-format considers files as \"main\" only when they end\nwith: ``.c``, ``.cc``, ``.cpp``, ``.c++``, ``.cxx``, ``.m`` or ``.mm``\nextensions.\nFor these files a guessing of \"main\" include takes place\n(to assign category 0, see above). This config option allows for\nadditional suffixes and extensions for files to be considered as \"main\".\n

For example, if this option is configured to ``(Impl\\.hpp)$``,\nthen a file ``ClassImpl.hpp`` is considered \"main\" (in addition to\n``Class.c``, ``Class.cc``, ``Class.cpp`` and so on) and \"main\ninclude file\" logic will be executed (with *IncludeIsMainRegex* setting\nalso being respected in later phase). Without this option set,\n``ClassImpl.hpp`` would not have the main include file put on top\nbefore any other include.

Documentation\n" + "x-intellij-html-description": "IncludeIsMainSourceRegex Documentation\n

Specify a regular expression for files being formatted\nthat are allowed to be considered \"main\" in the\nfile-to-main-include mapping.\n

By default, clang-format considers files as \"main\" only when they end\nwith: .c, .cc, .cpp, .c++, .cxx, .m or .mm\nextensions.\nFor these files a guessing of \"main\" include takes place\n(to assign category 0, see above). This config option allows for\nadditional suffixes and extensions for files to be considered as \"main\".\n

For example, if this option is configured to (Impl\\.hpp)$,\nthen a file ClassImpl.hpp is considered \"main\" (in addition to\nClass.c, Class.cc, Class.cpp and so on) and \"main\ninclude file\" logic will be executed (with *IncludeIsMainRegex* setting\nalso being respected in later phase). Without this option set,\nClassImpl.hpp would not have the main include file put on top\nbefore any other include.

From clang-format 10" }, "IndentAccessModifiers": { "type": "boolean", - "x-intellij-html-description": "

Specify whether access modifiers should have their own indentation level.\n

When ``false``, access modifiers are indented (or outdented) relative to\nthe record members, respecting the ``AccessModifierOffset``. Record\nmembers are indented one level below the record.\nWhen ``true``, access modifiers get their own indentation level. As a\nconsequence, record members are always indented 2 levels below the record,\nregardless of the access modifier presence. Value of the\n``AccessModifierOffset`` is ignored.\n

.. code-block:: c++\n

false: true:\n class C { vs. class C {\n class D { class D {\n void bar(); void bar();\n protected: protected:\n D(); D();\n }; };\n public: public:\n C(); C();\n }; };\n void foo() { void foo() {\n return 1; return 1;\n } }

Documentation\n" + "x-intellij-html-description": "IndentAccessModifiers Documentation\n

Specify whether access modifiers should have their own indentation level.\n

When false, access modifiers are indented (or outdented) relative to\nthe record members, respecting the AccessModifierOffset. Record\nmembers are indented one level below the record.\nWhen true, access modifiers get their own indentation level. As a\nconsequence, record members are always indented 2 levels below the record,\nregardless of the access modifier presence. Value of the\nAccessModifierOffset is ignored.\n\n

   false:                                 true:\n   class C {                      vs.     class C {\n     class D {                                class D {\n       void bar();                                void bar();\n     protected:                                 protected:\n       D();                                       D();\n     };                                       };\n   public:                                  public:\n     C();                                     C();\n   };                                     };\n   void foo() {                           void foo() {\n     return 1;                              return 1;\n   }                                      }\n

From clang-format 13" }, "IndentCaseBlocks": { "type": "boolean", - "x-intellij-html-description": "

Indent case label blocks one level from the case label.\n

When ``false``, the block following the case label uses the same\nindentation level as for the case label, treating the case label the same\nas an if-statement.\nWhen ``true``, the block gets indented as a scope block.\n

.. code-block:: c++\n

false: true:\n switch (fool) { vs. switch (fool) {\n case 1: { case 1:\n bar(); {\n } break; bar();\n default: { }\n plop(); break;\n } default:\n } {\n plop();\n }\n }

Documentation\n" + "x-intellij-html-description": "IndentCaseBlocks Documentation\n

Indent case label blocks one level from the case label.\n

When false, the block following the case label uses the same\nindentation level as for the case label, treating the case label the same\nas an if-statement.\nWhen true, the block gets indented as a scope block.\n\n

   false:                                 true:\n   switch (fool) {                vs.     switch (fool) {\n   case 1: {                              case 1:\n     bar();                                 {\n   } break;                                   bar();\n   default: {                               }\n     plop();                                break;\n   }                                      default:\n   }                                        {\n                                              plop();\n                                            }\n                                          }\n

From clang-format 11" }, "IndentCaseLabels": { "type": "boolean", - "x-intellij-html-description": "

Indent case labels one level from the switch statement.\n

When ``false``, use the same indentation level as for the switch\nstatement. Switch statement body is always indented one level more than\ncase labels (except the first block following the case label, which\nitself indents the code - unless IndentCaseBlocks is enabled).\n

.. code-block:: c++\n

false: true:\n switch (fool) { vs. switch (fool) {\n case 1: case 1:\n bar(); bar();\n break; break;\n default: default:\n plop(); plop();\n } }

Documentation\n" + "x-intellij-html-description": "IndentCaseLabels Documentation\n

Indent case labels one level from the switch statement.\n

When false, use the same indentation level as for the switch\nstatement. Switch statement body is always indented one level more than\ncase labels (except the first block following the case label, which\nitself indents the code - unless IndentCaseBlocks is enabled).\n\n

   false:                                 true:\n   switch (fool) {                vs.     switch (fool) {\n   case 1:                                  case 1:\n     bar();                                   bar();\n     break;                                   break;\n   default:                                 default:\n     plop();                                  plop();\n   }                                      }\n

From clang-format 3.3" }, "IndentExternBlock": { "type": "string", @@ -910,11 +1135,11 @@ "description": "Indents extern blocks." } }, - "x-intellij-html-description": "

IndentExternBlockStyle is the type of indenting of extern blocks.

Documentation\n" + "x-intellij-html-description": "IndentExternBlock Documentation\n

IndentExternBlockStyle is the type of indenting of extern blocks.

From clang-format 11

Invoke completion to see all options" }, "IndentGotoLabels": { "type": "boolean", - "x-intellij-html-description": "

Indent goto labels.\n

When ``false``, goto labels are flushed left.\n

.. code-block:: c++\n

true: false:\n int f() { vs. int f() {\n if (foo()) { if (foo()) {\n label1: label1:\n bar(); bar();\n } }\n label2: label2:\n return 1; return 1;\n } }

Documentation\n" + "x-intellij-html-description": "IndentGotoLabels Documentation\n

Indent goto labels.\n

When false, goto labels are flushed left.\n\n

   true:                                  false:\n   int f() {                      vs.     int f() {\n     if (foo()) {                           if (foo()) {\n     label1:                              label1:\n       bar();                                 bar();\n     }                                      }\n   label2:                                label2:\n     return 1;                              return 1;\n   }                                      }\n

From clang-format 10" }, "IndentPPDirectives": { "type": "string", @@ -934,23 +1159,27 @@ "description": "Indents directives before the hash." } }, - "x-intellij-html-description": "

The preprocessor directive indenting style to use.

Documentation\n" + "x-intellij-html-description": "IndentPPDirectives Documentation\n

The preprocessor directive indenting style to use.

From clang-format 6

Invoke completion to see all options" }, "IndentRequiresClause": { "type": "boolean", - "x-intellij-html-description": "

Indent the requires clause in a template. This only applies when\n``RequiresClausePosition`` is ``OwnLine``, or ``WithFollowing``.\n

In clang-format 12, 13 and 14 it was named ``IndentRequires``.\n

.. code-block:: c++\n

true:\n template \n requires Iterator\n void sort(It begin, It end) {\n //....\n }\n

false:\n template \n requires Iterator\n void sort(It begin, It end) {\n //....\n }

Documentation\n" + "x-intellij-html-description": "IndentRequiresClause Documentation\n

Indent the requires clause in a template. This only applies when\nRequiresClausePosition is OwnLine, or WithFollowing.\n

In clang-format 12, 13 and 14 it was named IndentRequires.\n\n

   true:\n   template <typename It>\n     requires Iterator<It>\n   void sort(It begin, It end) {\n     //....\n   }\n\n   false:\n   template <typename It>\n   requires Iterator<It>\n   void sort(It begin, It end) {\n     //....\n   }\n

From clang-format 15" }, "IndentWidth": { "type": "number", - "x-intellij-html-description": "

The number of columns to use for indentation.\n

.. code-block:: c++\n

IndentWidth: 3\n

void f() {\n someFunction();\n if (true, false) {\n f();\n }\n }

Documentation\n" + "x-intellij-html-description": "IndentWidth Documentation\n

The number of columns to use for indentation.\n\n

   IndentWidth: 3\n\n   void f() {\n      someFunction();\n      if (true, false) {\n         f();\n      }\n   }\n

From clang-format 3.7" }, "IndentWrappedFunctionNames": { "type": "boolean", - "x-intellij-html-description": "

Indent if a function definition or declaration is wrapped after the\ntype.\n

.. code-block:: c++\n

true:\n LoooooooooooooooooooooooooooooooooooooooongReturnType\n LoooooooooooooooooooooooooooooooongFunctionDeclaration();\n

false:\n LoooooooooooooooooooooooooooooooooooooooongReturnType\n LoooooooooooooooooooooooooooooooongFunctionDeclaration();

Documentation\n" + "x-intellij-html-description": "IndentWrappedFunctionNames Documentation\n

Indent if a function definition or declaration is wrapped after the\ntype.\n\n

   true:\n   LoooooooooooooooooooooooooooooooooooooooongReturnType\n       LoooooooooooooooooooooooooooooooongFunctionDeclaration();\n\n   false:\n   LoooooooooooooooooooooooooooooooooooooooongReturnType\n   LoooooooooooooooooooooooooooooooongFunctionDeclaration();\n

From clang-format 3.7" }, "InsertBraces": { "type": "boolean", - "x-intellij-html-description": "

Insert braces after control statements (``if``, ``else``, ``for``, ``do``,\nand ``while``) in C++ unless the control statements are inside macro\ndefinitions or the braces would enclose preprocessor directives.\n

.. warning:: \n

Setting this option to `true` could lead to incorrect code formatting due\n to clang-format's lack of complete semantic information. As such, extra\n care should be taken to review code changes made by this option.\n

.. code-block:: c++\n

false: true:\n

if (isa(D)) vs. if (isa(D)) {\n handleFunctionDecl(D); handleFunctionDecl(D);\n else if (isa(D)) } else if (isa(D)) {\n handleVarDecl(D); handleVarDecl(D);\n else } else {\n return; return;\n }\n

while (i--) vs. while (i--) {\n for (auto *A : D.attrs()) for (auto *A : D.attrs()) {\n handleAttr(A); handleAttr(A);\n }\n }\n

do vs. do {\n --i; --i;\n while (i); } while (i);

Documentation\n" + "x-intellij-html-description": "InsertBraces Documentation\n

Insert braces after control statements (if, else, for, do,\nand while) in C++ unless the control statements are inside macro\ndefinitions or the braces would enclose preprocessor directives.\nWarning: Setting this option to true could lead to incorrect code formatting\n due to clang-format's lack of complete semantic information. As such,\n extra care should be taken to review code changes made by this option.\n\n

  false:                                    true:\n\n  if (isa<FunctionDecl>(D))        vs.      if (isa<FunctionDecl>(D)) {\n    handleFunctionDecl(D);                    handleFunctionDecl(D);\n  else if (isa<VarDecl>(D))                 } else if (isa<VarDecl>(D)) {\n    handleVarDecl(D);                         handleVarDecl(D);\n  else                                      } else {\n    return;                                   return;\n                                            }\n\n  while (i--)                      vs.      while (i--) {\n    for (auto *A : D.attrs())                 for (auto *A : D.attrs()) {\n      handleAttr(A);                            handleAttr(A);\n                                              }\n                                            }\n\n  do                               vs.      do {\n    --i;                                      --i;\n  while (i);                                } while (i);\n

From clang-format 15" + }, + "InsertNewlineAtEOF": { + "type": "boolean", + "x-intellij-html-description": "InsertNewlineAtEOF Documentation\n

Insert a newline at end of file if missing.

From clang-format 16" }, "InsertTrailingCommas": { "type": "string", @@ -966,33 +1195,45 @@ "description": "Insert trailing commas in container literals that were wrapped over" } }, - "x-intellij-html-description": "

If set to ``TCS_Wrapped`` will insert trailing commas in container\nliterals (arrays and objects) that wrap across multiple lines.\nIt is currently only available for JavaScript\nand disabled by default ``TCS_None``.\n``InsertTrailingCommas`` cannot be used together with ``BinPackArguments``\nas inserting the comma disables bin-packing.\n

.. code-block:: c++\n

TSC_Wrapped:\n const someArray = [\n aaaaaaaaaaaaaaaaaaaaaaaaaa,\n aaaaaaaaaaaaaaaaaaaaaaaaaa,\n aaaaaaaaaaaaaaaaaaaaaaaaaa,\n // ^ inserted\n ]

Documentation\n" + "x-intellij-html-description": "InsertTrailingCommas Documentation\n

If set to TCS_Wrapped will insert trailing commas in container\nliterals (arrays and objects) that wrap across multiple lines.\nIt is currently only available for JavaScript\nand disabled by default TCS_None.\nInsertTrailingCommas cannot be used together with BinPackArguments\nas inserting the comma disables bin-packing.\n\n

  TSC_Wrapped:\n  const someArray = [\n  aaaaaaaaaaaaaaaaaaaaaaaaaa,\n  aaaaaaaaaaaaaaaaaaaaaaaaaa,\n  aaaaaaaaaaaaaaaaaaaaaaaaaa,\n  //                        ^ inserted\n  ]\n

From clang-format 11

Invoke completion to see all options" }, "IntegerLiteralSeparator": { "type": "object", "additionalProperties": false, "properties": { "Binary": { - "type": "???(int8_t)", - "x-intellij-html-description": "

.. code-block:: c++\n

-1: 0b100111101101\n 0: 0b10011'11'0110'1\n 3: 0b100'111'101'101\n 4: 0b1001'1110'1101" + "type": "number", + "x-intellij-html-description": "Format separators in binary literals.\n\n

  /* -1: */ b = 0b100111101101;\n  /*  0: */ b = 0b10011'11'0110'1;\n  /*  3: */ b = 0b100'111'101'101;\n  /*  4: */ b = 0b1001'1110'1101;\n

IntegerLiteralSeparator Documentation\n" + }, + "BinaryMinDigits": { + "type": "number", + "x-intellij-html-description": "Format separators in binary literals with a minimum number of digits.\n\n

  // Binary: 3\n  // BinaryMinDigits: 7\n  b1 = 0b101101;\n  b2 = 0b1'101'101;\n

IntegerLiteralSeparator Documentation\n" }, "Decimal": { - "type": "???(int8_t)", - "x-intellij-html-description": "

.. code-block:: c++\n

-1: 18446744073709550592ull\n 0: 184467'440737'0'95505'92ull\n 3: 18'446'744'073'709'550'592ull" + "type": "number", + "x-intellij-html-description": "Format separators in decimal literals.\n\n

  /* -1: */ d = 18446744073709550592ull;\n  /*  0: */ d = 184467'440737'0'95505'92ull;\n  /*  3: */ d = 18'446'744'073'709'550'592ull;\n

IntegerLiteralSeparator Documentation\n" + }, + "DecimalMinDigits": { + "type": "number", + "x-intellij-html-description": "Format separators in decimal literals with a minimum number of digits.\n\n

  // Decimal: 3\n  // DecimalMinDigits: 5\n  d1 = 2023;\n  d2 = 10'000;\n

IntegerLiteralSeparator Documentation\n" }, "Hex": { - "type": "???(int8_t)", - "x-intellij-html-description": "

.. code-block:: c++\n

-1: 0xDEADBEEFDEADBEEFuz\n 0: 0xDEAD'BEEF'DE'AD'BEE'Fuz\n 2: 0xDE'AD'BE'EF'DE'AD'BE'EFuz" + "type": "number", + "x-intellij-html-description": "Format separators in hexadecimal literals.\n\n

  /* -1: */ h = 0xDEADBEEFDEADBEEFuz;\n  /*  0: */ h = 0xDEAD'BEEF'DE'AD'BEE'Fuz;\n  /*  2: */ h = 0xDE'AD'BE'EF'DE'AD'BE'EFuz;\n

IntegerLiteralSeparator Documentation\n" + }, + "HexMinDigits": { + "type": "number", + "x-intellij-html-description": "Format separators in hexadecimal literals with a minimum number of\ndigits.\n\n

  // Hex: 2\n  // HexMinDigits: 6\n  h1 = 0xABCDE;\n  h2 = 0xAB'CD'EF;\n

IntegerLiteralSeparator Documentation\n" } }, - "x-intellij-html-description": "

Format integer literal separators (``'`` for C++ and ``_`` for C#, Java,\nand JavaScript).

Documentation\n" + "x-intellij-html-description": "IntegerLiteralSeparator Documentation\n

Format integer literal separators (' for C++ and _ for C#, Java,\nand JavaScript).

Separator format of integer literals of different bases.\n

If negative, remove separators. If 0, leave the literal as is. If\npositive, insert separators between digits starting from the rightmost\ndigit.\n

For example, the config below will leave separators in binary literals\nalone, insert separators in decimal literals to separate the digits into\ngroups of 3, and remove separators in hexadecimal literals.\n\n

  IntegerLiteralSeparator:\n    Binary: 0\n    Decimal: 3\n    Hex: -1\n
\n

You can also specify a minimum number of digits (BinaryMinDigits,\nDecimalMinDigits, and HexMinDigits) the integer literal must\nhave in order for the separators to be inserted.

From clang-format 16" }, "JavaImportGroups": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of prefixes ordered by the desired groups for Java imports.\n

One group's prefix can be a subset of another - the longest prefix is\nalways matched. Within a group, the imports are ordered lexicographically.\nStatic imports are grouped separately and follow the same group rules.\nBy default, static imports are placed before non-static imports,\nbut this behavior is changed by another option,\n``SortJavaStaticImport``.\n

In the .clang-format configuration file, this can be configured like\nin the following yaml example. This will result in imports being\nformatted as in the Java example below.\n

.. code-block:: yaml\n

JavaImportGroups: ['com.example', 'com', 'org']\n

\n.. code-block:: java\n

import static com.example.function1;\n

import static com.test.function2;\n

import static org.example.function3;\n

import com.example.ClassA;\n import com.example.Test;\n import com.example.a.ClassB;\n

import com.test.ClassC;\n

import org.example.ClassD;

Documentation\n" + "x-intellij-html-description": "JavaImportGroups Documentation\n

A vector of prefixes ordered by the desired groups for Java imports.\n

One group's prefix can be a subset of another - the longest prefix is\nalways matched. Within a group, the imports are ordered lexicographically.\nStatic imports are grouped separately and follow the same group rules.\nBy default, static imports are placed before non-static imports,\nbut this behavior is changed by another option,\nSortJavaStaticImport.\n

In the .clang-format configuration file, this can be configured like\nin the following yaml example. This will result in imports being\nformatted as in the Java example below.\n\n

  JavaImportGroups: [com.example, com, org]\n
\n

\n

   import static com.example.function1;\n\n   import static com.test.function2;\n\n   import static org.example.function3;\n\n   import com.example.ClassA;\n   import com.example.Test;\n   import com.example.a.ClassB;\n\n   import com.test.ClassC;\n\n   import org.example.ClassD;\n

From clang-format 8" }, "JavaScriptQuotes": { "type": "string", @@ -1012,15 +1253,38 @@ "description": "Always use double quotes." } }, - "x-intellij-html-description": "

The JavaScriptQuoteStyle to use for JavaScript strings.

Documentation\n" + "x-intellij-html-description": "JavaScriptQuotes Documentation\n

The JavaScriptQuoteStyle to use for JavaScript strings.

From clang-format 3.9

Invoke completion to see all options" }, "JavaScriptWrapImports": { "type": "boolean", - "x-intellij-html-description": "

Whether to wrap JavaScript import/export statements.\n

.. code-block:: js\n

true:\n import {\n VeryLongImportsAreAnnoying,\n VeryLongImportsAreAnnoying,\n VeryLongImportsAreAnnoying,\n } from 'some/module.js'\n

false:\n import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from \"some/module.js\"

Documentation\n" + "x-intellij-html-description": "JavaScriptWrapImports Documentation\n

Whether to wrap JavaScript import/export statements.\n\n

   true:\n   import {\n       VeryLongImportsAreAnnoying,\n       VeryLongImportsAreAnnoying,\n       VeryLongImportsAreAnnoying,\n   } from \"some/module.js\"\n\n   false:\n   import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from \"some/module.js\"\n

From clang-format 3.9" + }, + "KeepEmptyLines": { + "type": "object", + "additionalProperties": false, + "properties": { + "AtEndOfFile": { + "type": "boolean", + "x-intellij-html-description": "Keep empty lines at end of file.

KeepEmptyLines Documentation\n" + }, + "AtStartOfBlock": { + "type": "boolean", + "x-intellij-html-description": "Keep empty lines at start of a block.\n\n

   true:                                  false:\n   if (foo) {                     vs.     if (foo) {\n                                            bar();\n     bar();                               }\n   }\n

KeepEmptyLines Documentation\n" + }, + "AtStartOfFile": { + "type": "boolean", + "x-intellij-html-description": "Keep empty lines at start of file.

KeepEmptyLines Documentation\n" + } + }, + "x-intellij-html-description": "KeepEmptyLines Documentation\n

Which empty lines are kept. See MaxEmptyLinesToKeep for how many\nconsecutive empty lines are kept.

Options regarding which empty lines are kept.\n

For example, the config below will remove empty lines at start of the\nfile, end of the file, and start of blocks.\n

\n

  KeepEmptyLines:\n    AtEndOfFile: false\n    AtStartOfBlock: false\n    AtStartOfFile: false\n

From clang-format 19" + }, + "KeepEmptyLinesAtEOF": { + "type": "boolean", + "x-intellij-html-description": "KeepEmptyLinesAtEOF Documentation\n

This option is deprecated. See AtEndOfFile of KeepEmptyLines.

From clang-format 17" }, "KeepEmptyLinesAtTheStartOfBlocks": { "type": "boolean", - "x-intellij-html-description": "

If true, the empty line at the start of blocks is kept.\n

.. code-block:: c++\n

true: false:\n if (foo) { vs. if (foo) {\n bar();\n bar(); }\n }

Documentation\n" + "x-intellij-html-description": "KeepEmptyLinesAtTheStartOfBlocks Documentation\n

This option is deprecated. See AtStartOfBlock of KeepEmptyLines.

From clang-format 3.7" }, "LambdaBodyIndentation": { "type": "string", @@ -1033,10 +1297,10 @@ "description": "Align lambda body relative to the lambda signature. This is the default." }, "OuterScope": { - "description": "Align lambda body relative to the indentation level of the outer scope" + "description": "For statements within block scope, align lambda body relative to the" } }, - "x-intellij-html-description": "

The indentation style of lambda bodies. ``Signature`` (the default)\ncauses the lambda body to be indented one additional level relative to\nthe indentation level of the signature. ``OuterScope`` forces the lambda\nbody to be indented one additional level relative to the parent scope\ncontaining the lambda signature. For callback-heavy code, it may improve\nreadability to have the signature indented two levels and to use\n``OuterScope``. The KJ style guide requires ``OuterScope``.\n`KJ style guide\n`_

Documentation\n" + "x-intellij-html-description": "LambdaBodyIndentation Documentation\n

The indentation style of lambda bodies. Signature (the default)\ncauses the lambda body to be indented one additional level relative to\nthe indentation level of the signature. OuterScope forces the lambda\nbody to be indented one additional level relative to the parent scope\ncontaining the lambda signature.

From clang-format 13

Invoke completion to see all options" }, "Language": { "type": "string", @@ -1088,19 +1352,70 @@ "description": "Should be used for Verilog and SystemVerilog." } }, - "x-intellij-html-description": "

Language, this format style is targeted at.

Documentation\n" + "x-intellij-html-description": "Language Documentation\n

Language, this format style is targeted at.

From clang-format 3.5

Invoke completion to see all options" + }, + "LineEnding": { + "type": "string", + "enum": [ + "LF", + "CRLF", + "DeriveLF", + "DeriveCRLF" + ], + "x-intellij-enum-metadata": { + "LF": { + "description": "Use ``\\n``." + }, + "CRLF": { + "description": "Use ``\\r\\n``." + }, + "DeriveLF": { + "description": "Use ``\\n`` unless the input has more lines ending in ``\\r\\n``." + }, + "DeriveCRLF": { + "description": "Use ``\\r\\n`` unless the input has more lines ending in ``\\n``." + } + }, + "x-intellij-html-description": "LineEnding Documentation\n

Line ending style (\\n or \\r\\n) to use.

From clang-format 16

Invoke completion to see all options" }, "MacroBlockBegin": { "type": "string", - "x-intellij-html-description": "

A regular expression matching macros that start a block.\n

.. code-block:: c++\n

# With:\n MacroBlockBegin: \"^NS_MAP_BEGIN|\\\n NS_TABLE_HEAD$\"\n MacroBlockEnd: \"^\\\n NS_MAP_END|\\\n NS_TABLE_.*_END$\"\n

NS_MAP_BEGIN\n foo();\n NS_MAP_END\n

NS_TABLE_HEAD\n bar();\n NS_TABLE_FOO_END\n

# Without:\n NS_MAP_BEGIN\n foo();\n NS_MAP_END\n

NS_TABLE_HEAD\n bar();\n NS_TABLE_FOO_END

Documentation\n" + "x-intellij-html-description": "MacroBlockBegin Documentation\n

A regular expression matching macros that start a block.\n\n

   # With:\n   MacroBlockBegin: \"^NS_MAP_BEGIN|\\\n   NS_TABLE_HEAD$\"\n   MacroBlockEnd: \"^\\\n   NS_MAP_END|\\\n   NS_TABLE_.*_END$\"\n\n   NS_MAP_BEGIN\n     foo();\n   NS_MAP_END\n\n   NS_TABLE_HEAD\n     bar();\n   NS_TABLE_FOO_END\n\n   # Without:\n   NS_MAP_BEGIN\n   foo();\n   NS_MAP_END\n\n   NS_TABLE_HEAD\n   bar();\n   NS_TABLE_FOO_END\n

From clang-format 3.7" }, "MacroBlockEnd": { "type": "string", - "x-intellij-html-description": "

A regular expression matching macros that end a block.

Documentation\n" + "x-intellij-html-description": "MacroBlockEnd Documentation\n

A regular expression matching macros that end a block.

From clang-format 3.7" + }, + "Macros": { + "type": "array", + "items": { + "type": "string" + }, + "x-intellij-html-description": "Macros Documentation\n

A list of macros of the form = .\n

Code will be parsed with macros expanded, in order to determine how to\ninterpret and format the macro arguments.\n

For example, the code:\n\n

  A(a*b);\n
\n

will usually be interpreted as a call to a function A, and the\nmultiplication expression will be formatted as a * b.\n

If we specify the macro definition:\n\n

  Macros:\n  - A(x)=x\n
\n

the code will now be parsed as a declaration of the variable b of type a*,\nand formatted as a* b (depending on pointer-binding rules).\n

Features and restrictions:\n * Both function-like macros and object-like macros are supported.\n * Macro arguments must be used exactly once in the expansion.\n * No recursive expansion; macros referencing other macros will be\n ignored.\n * Overloading by arity is supported: for example, given the macro\n definitions A=x, A()=y, A(a)=a\n

\n

   A; -> x;\n   A(); -> y;\n   A(z); -> z;\n   A(a, b); // will not be expanded.\n
\n

From clang-format 17" + }, + "MainIncludeChar": { + "type": "string", + "enum": [ + "Quote", + "AngleBracket", + "Any" + ], + "x-intellij-enum-metadata": { + "Quote": { + "description": "Main include uses quotes: ``#include \"foo.hpp\"`` (the default)." + }, + "AngleBracket": { + "description": "Main include uses angle brackets: ``#include ``." + }, + "Any": { + "description": "Main include uses either quotes or angle brackets." + } + }, + "x-intellij-html-description": "MainIncludeChar Documentation\n

When guessing whether a #include is the \"main\" include, only the include\ndirectives that use the specified character are considered.

From clang-format 19

Invoke completion to see all options" }, "MaxEmptyLinesToKeep": { "type": "number", - "x-intellij-html-description": "

The maximum number of consecutive empty lines to keep.\n

.. code-block:: c++\n

MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0\n int f() { int f() {\n int = 1; int i = 1;\n i = foo();\n i = foo(); return i;\n }\n return i;\n }

Documentation\n" + "x-intellij-html-description": "MaxEmptyLinesToKeep Documentation\n

The maximum number of consecutive empty lines to keep.\n\n

   MaxEmptyLinesToKeep: 1         vs.     MaxEmptyLinesToKeep: 0\n   int f() {                              int f() {\n     int = 1;                                 int i = 1;\n                                              i = foo();\n     i = foo();                               return i;\n                                          }\n     return i;\n   }\n

From clang-format 3.7" }, "NamespaceIndentation": { "type": "string", @@ -1120,14 +1435,14 @@ "description": "Indent in all namespaces." } }, - "x-intellij-html-description": "

The indentation used for namespaces.

Documentation\n" + "x-intellij-html-description": "NamespaceIndentation Documentation\n

The indentation used for namespaces.

From clang-format 3.7

Invoke completion to see all options" }, "NamespaceMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of macros which are used to open namespace blocks.\n

These are expected to be macros of the form:\n

.. code-block:: c++\n

NAMESPACE(, ...) {\n \n }\n

For example: TESTSUITE

Documentation\n" + "x-intellij-html-description": "NamespaceMacros Documentation\n

A vector of macros which are used to open namespace blocks.\n

These are expected to be macros of the form:\n\n

  NAMESPACE(<namespace-name>, ...) {\n    <namespace-content>\n  }\n
\n

For example: TESTSUITE

From clang-format 9" }, "ObjCBinPackProtocolList": { "type": "string", @@ -1147,27 +1462,34 @@ "description": "Never bin-pack parameters." } }, - "x-intellij-html-description": "

Controls bin-packing Objective-C protocol conformance list\nitems into as few lines as possible when they go over ``ColumnLimit``.\n

If ``Auto`` (the default), delegates to the value in\n``BinPackParameters``. If that is ``true``, bin-packs Objective-C\nprotocol conformance list items into as few lines as possible\nwhenever they go over ``ColumnLimit``.\n

If ``Always``, always bin-packs Objective-C protocol conformance\nlist items into as few lines as possible whenever they go over\n``ColumnLimit``.\n

If ``Never``, lays out Objective-C protocol conformance list items\nonto individual lines whenever they go over ``ColumnLimit``.\n

\n.. code-block:: objc\n

Always (or Auto, if BinPackParameters=true):\n @interface ccccccccccccc () <\n ccccccccccccc, ccccccccccccc,\n ccccccccccccc, ccccccccccccc> {\n }\n

Never (or Auto, if BinPackParameters=false):\n @interface ddddddddddddd () <\n ddddddddddddd,\n ddddddddddddd,\n ddddddddddddd,\n ddddddddddddd> {\n }

Documentation\n" + "x-intellij-html-description": "ObjCBinPackProtocolList Documentation\n

Controls bin-packing Objective-C protocol conformance list\nitems into as few lines as possible when they go over ColumnLimit.\n

If Auto (the default), delegates to the value in\nBinPackParameters. If that is true, bin-packs Objective-C\nprotocol conformance list items into as few lines as possible\nwhenever they go over ColumnLimit.\n

If Always, always bin-packs Objective-C protocol conformance\nlist items into as few lines as possible whenever they go over\nColumnLimit.\n

If Never, lays out Objective-C protocol conformance list items\nonto individual lines whenever they go over ColumnLimit.\n

\n

   Always (or Auto, if BinPackParameters=true):\n   @interface ccccccccccccc () <\n       ccccccccccccc, ccccccccccccc,\n       ccccccccccccc, ccccccccccccc> {\n   }\n\n   Never (or Auto, if BinPackParameters=false):\n   @interface ddddddddddddd () <\n       ddddddddddddd,\n       ddddddddddddd,\n       ddddddddddddd,\n       ddddddddddddd> {\n   }\n

From clang-format 7

Invoke completion to see all options" }, "ObjCBlockIndentWidth": { "type": "number", - "x-intellij-html-description": "

The number of characters to use for indentation of ObjC blocks.\n

.. code-block:: objc\n

ObjCBlockIndentWidth: 4\n

[operation setCompletionBlock:^{\n [self onOperationDone];\n }];

Documentation\n" + "x-intellij-html-description": "ObjCBlockIndentWidth Documentation\n

The number of characters to use for indentation of ObjC blocks.\n\n

   ObjCBlockIndentWidth: 4\n\n   [operation setCompletionBlock:^{\n       [self onOperationDone];\n   }];\n

From clang-format 3.7" }, "ObjCBreakBeforeNestedBlockParam": { "type": "boolean", - "x-intellij-html-description": "

Break parameters list into lines when there is nested block\nparameters in a function call.\n

.. code-block:: c++\n

false:\n - (void)_aMethod\n {\n [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber\n *u, NSNumber *v) {\n u = c;\n }]\n }\n true:\n - (void)_aMethod\n {\n [self.test1 t:self\n w:self\n callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {\n u = c;\n }]\n }

Documentation\n" + "x-intellij-html-description": "ObjCBreakBeforeNestedBlockParam Documentation\n

Break parameters list into lines when there is nested block\nparameters in a function call.\n\n

  false:\n   - (void)_aMethod\n   {\n       [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber\n       *u, NSNumber *v) {\n           u = c;\n       }]\n   }\n   true:\n   - (void)_aMethod\n   {\n      [self.test1 t:self\n                   w:self\n          callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {\n               u = c;\n           }]\n   }\n

From clang-format 11" + }, + "ObjCPropertyAttributeOrder": { + "type": "array", + "items": { + "type": "string" + }, + "x-intellij-html-description": "ObjCPropertyAttributeOrder Documentation\n

The order in which ObjC property attributes should appear.\n

Attributes in code will be sorted in the order specified. Any attributes\nencountered that are not mentioned in this array will be sorted last, in\nstable order. Comments between attributes will leave the attributes\nuntouched.\nWarning: Using this option could lead to incorrect code formatting due to\n clang-format's lack of complete semantic information. As such, extra\n care should be taken to review code changes made by this option.\n\n

  ObjCPropertyAttributeOrder: [\n      class, direct,\n      atomic, nonatomic,\n      assign, retain, strong, copy, weak, unsafe_unretained,\n      readonly, readwrite, getter, setter,\n      nullable, nonnull, null_resettable, null_unspecified\n  ]\n

From clang-format 18" }, "ObjCSpaceAfterProperty": { "type": "boolean", - "x-intellij-html-description": "

Add a space after ``@property`` in Objective-C, i.e. use\n``@property (readonly)`` instead of ``@property(readonly)``.

Documentation\n" + "x-intellij-html-description": "ObjCSpaceAfterProperty Documentation\n

Add a space after @property in Objective-C, i.e. use\n@property (readonly) instead of @property(readonly).

From clang-format 3.7" }, "ObjCSpaceBeforeProtocolList": { "type": "boolean", - "x-intellij-html-description": "

Add a space in front of an Objective-C protocol list, i.e. use\n``Foo `` instead of ``Foo``.

Documentation\n" + "x-intellij-html-description": "ObjCSpaceBeforeProtocolList Documentation\n

Add a space in front of an Objective-C protocol list, i.e. use\nFoo instead of Foo.

From clang-format 3.7" }, "PPIndentWidth": { "type": "number", - "x-intellij-html-description": "

The number of columns to use for indentation of preprocessor statements.\nWhen set to -1 (default) ``IndentWidth`` is used also for preprocessor\nstatements.\n

.. code-block:: c++\n

PPIndentWidth: 1\n

#ifdef __linux__\n # define FOO\n #else\n # define BAR\n #endif

Documentation\n" + "x-intellij-html-description": "PPIndentWidth Documentation\n

The number of columns to use for indentation of preprocessor statements.\nWhen set to -1 (default) IndentWidth is used also for preprocessor\nstatements.\n\n

   PPIndentWidth: 1\n\n   #ifdef __linux__\n   # define FOO\n   #else\n   # define BAR\n   #endif\n

From clang-format 13" }, "PackConstructorInitializers": { "type": "string", @@ -1175,7 +1497,8 @@ "Never", "BinPack", "CurrentLine", - "NextLine" + "NextLine", + "NextLineOnly" ], "x-intellij-enum-metadata": { "Never": { @@ -1189,49 +1512,56 @@ }, "NextLine": { "description": "Same as ``PCIS_CurrentLine`` except that if all constructor initializers" + }, + "NextLineOnly": { + "description": "Put all constructor initializers on the next line if they fit." } }, - "x-intellij-html-description": "

The pack constructor initializers style to use.

Documentation\n" + "x-intellij-html-description": "PackConstructorInitializers Documentation\n

The pack constructor initializers style to use.

From clang-format 14

Invoke completion to see all options" }, "PenaltyBreakAssignment": { "type": "number", - "x-intellij-html-description": "

The penalty for breaking around an assignment operator.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakAssignment Documentation\n

The penalty for breaking around an assignment operator.

From clang-format 5" }, "PenaltyBreakBeforeFirstCallParameter": { "type": "number", - "x-intellij-html-description": "

The penalty for breaking a function call after ``call(``.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakBeforeFirstCallParameter Documentation\n

The penalty for breaking a function call after call(.

From clang-format 3.7" }, "PenaltyBreakComment": { "type": "number", - "x-intellij-html-description": "

The penalty for each line break introduced inside a comment.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakComment Documentation\n

The penalty for each line break introduced inside a comment.

From clang-format 3.7" }, "PenaltyBreakFirstLessLess": { "type": "number", - "x-intellij-html-description": "

The penalty for breaking before the first ``<<``.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakFirstLessLess Documentation\n

The penalty for breaking before the first <<.

From clang-format 3.7" }, "PenaltyBreakOpenParenthesis": { "type": "number", - "x-intellij-html-description": "

The penalty for breaking after ``(``.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakOpenParenthesis Documentation\n

The penalty for breaking after (.

From clang-format 14" + }, + "PenaltyBreakScopeResolution": { + "type": "number", + "x-intellij-html-description": "PenaltyBreakScopeResolution Documentation\n

The penalty for breaking after ::.

From clang-format 18" }, "PenaltyBreakString": { "type": "number", - "x-intellij-html-description": "

The penalty for each line break introduced inside a string literal.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakString Documentation\n

The penalty for each line break introduced inside a string literal.

From clang-format 3.7" }, "PenaltyBreakTemplateDeclaration": { "type": "number", - "x-intellij-html-description": "

The penalty for breaking after template declaration.

Documentation\n" + "x-intellij-html-description": "PenaltyBreakTemplateDeclaration Documentation\n

The penalty for breaking after template declaration.

From clang-format 7" }, "PenaltyExcessCharacter": { "type": "number", - "x-intellij-html-description": "

The penalty for each character outside of the column limit.

Documentation\n" + "x-intellij-html-description": "PenaltyExcessCharacter Documentation\n

The penalty for each character outside of the column limit.

From clang-format 3.7" }, "PenaltyIndentedWhitespace": { "type": "number", - "x-intellij-html-description": "

Penalty for each character of whitespace indentation\n(counted relative to leading non-whitespace column).

Documentation\n" + "x-intellij-html-description": "PenaltyIndentedWhitespace Documentation\n

Penalty for each character of whitespace indentation\n(counted relative to leading non-whitespace column).

From clang-format 12" }, "PenaltyReturnTypeOnItsOwnLine": { "type": "number", - "x-intellij-html-description": "

Penalty for putting the return type of a function onto its own line.

Documentation\n" + "x-intellij-html-description": "PenaltyReturnTypeOnItsOwnLine Documentation\n

Penalty for putting the return type of a function onto its own line.

From clang-format 3.7" }, "PointerAlignment": { "type": "string", @@ -1251,7 +1581,7 @@ "description": "Align pointer in the middle." } }, - "x-intellij-html-description": "

Pointer and reference alignment style.

Documentation\n" + "x-intellij-html-description": "PointerAlignment Documentation\n

Pointer and reference alignment style.

From clang-format 3.7

Invoke completion to see all options" }, "QualifierAlignment": { "type": "string", @@ -1275,93 +1605,49 @@ "description": "Change specifiers/qualifiers to be aligned based on ``QualifierOrder``." } }, - "x-intellij-html-description": "

Different ways to arrange specifiers and qualifiers (e.g. const/volatile).\n

.. warning:: \n

Setting ``QualifierAlignment`` to something other than `Leave`, COULD\n lead to incorrect code formatting due to incorrect decisions made due to\n clang-formats lack of complete semantic information.\n As such extra care should be taken to review code changes made by the use\n of this option.

Documentation\n" + "x-intellij-html-description": "QualifierAlignment Documentation\n

Different ways to arrange specifiers and qualifiers (e.g. const/volatile).\nWarning: Setting QualifierAlignment to something other than Leave, COULD\n lead to incorrect code formatting due to incorrect decisions made due to\n clang-formats lack of complete semantic information.\n As such extra care should be taken to review code changes made by the use\n of this option.

From clang-format 14

Invoke completion to see all options" }, "QualifierOrder": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

The order in which the qualifiers appear.\nOrder is an array that can contain any of the following:\n

* const\n * inline\n * static\n * friend\n * constexpr\n * volatile\n * restrict\n * type\n

Note: it MUST contain 'type'.\nItems to the left of 'type' will be placed to the left of the type and\naligned in the order supplied. Items to the right of 'type' will be placed\nto the right of the type and aligned in the order supplied.\n

\n.. code-block:: yaml\n

QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]

Documentation\n" + "x-intellij-html-description": "QualifierOrder Documentation\n

The order in which the qualifiers appear.\nOrder is an array that can contain any of the following:\n

* const\n * inline\n * static\n * friend\n * constexpr\n * volatile\n * restrict\n * type\n

Note It **must** contain type.\n

Items to the left of type will be placed to the left of the type and\naligned in the order supplied. Items to the right of type will be\nplaced to the right of the type and aligned in the order supplied.\n

\n

  QualifierOrder: [inline, static, type, const, volatile]\n

From clang-format 14" }, "RawStringFormats": { "type": "array", "items": { "type": "object", + "additionalProperties": false, "properties": { "Language": { - "x-intellij-html-description": "The language of this raw string.", + "x-intellij-html-description": "The language of this raw string.\n

RawStringFormats Documentation\n" + }, + "BasedOnStyle": { "type": "string", - "enum": [ - "None", - "Cpp", - "CSharp", - "Java", - "JavaScript", - "ObjC", - "Proto", - "TableGen", - "TextProto" - ] + "x-intellij-html-description": "The style name on which this raw string format is based on.\nIf not specified, the raw string format is based on the style that this\nformat is based on.

RawStringFormats Documentation\n" + }, + "CanonicalDelimiter": { + "type": "string", + "x-intellij-html-description": "The canonical delimiter for this language.

RawStringFormats Documentation\n" }, "Delimiters": { - "x-intellij-html-description": "A list of raw string delimiters that match this language.", "type": "array", "items": { "type": "string" - } + }, + "x-intellij-html-description": "A list of raw string delimiters that match this language.

RawStringFormats Documentation\n" }, "EnclosingFunctions": { - "x-intellij-html-description": "A list of enclosing function names that match this language.", "type": "array", "items": { "type": "string" - } - }, - "BasedOnStyle": { - "x-intellij-html-description": "The style name on which this raw string format is based on. If not specified, the raw string format is based on the style that this format is based on.", - "type": "string", - "enum": [ - "LLVM", - "Google", - "Chromium", - "Mozilla", - "WebKit", - "Microsoft", - "GNU", - "InheritParentConfig" - ], - "x-intellij-enum-metadata": { - "LLVM": { - "description": "A style complying with the LLVM coding standards" - }, - "Google": { - "description": "A style complying with Google's C++ style guide" - }, - "Chromium": { - "description": "A style complying with Chromium's style guide" - }, - "Mozilla": { - "description": "A style complying with Mozilla's style guide" - }, - "WebKit": { - "description": "A style complying with WebKit's style guide" - }, - "Microsoft": { - "description": "A style complying with Microsoft's style guide" - }, - "GNU": { - "description": "A style complying with the GNU coding standards" - } - } - }, - "CanonicalDelimiter": { - "x-intellij-html-description": "The canonical delimiter for this language.", - "type": "string" + }, + "x-intellij-html-description": "A list of enclosing function names that match this language.

RawStringFormats Documentation\n" } } }, - "x-intellij-html-description": "

Defines hints for detecting supported languages code blocks in raw\nstrings.\n

A raw string with a matching delimiter or a matching enclosing function\nname will be reformatted assuming the specified language based on the\nstyle for that language defined in the .clang-format file. If no style has\nbeen defined in the .clang-format file for the specific language, a\npredefined style given by 'BasedOnStyle' is used. If 'BasedOnStyle' is not\nfound, the formatting is based on llvm style. A matching delimiter takes\nprecedence over a matching enclosing function name for determining the\nlanguage of the raw string contents.\n

If a canonical delimiter is specified, occurrences of other delimiters for\nthe same language will be updated to the canonical if possible.\n

There should be at most one specification per language and each delimiter\nand enclosing function should not occur in multiple specifications.\n

To configure this in the .clang-format file, use:\n

.. code-block:: yaml\n

RawStringFormats:\n - Language: TextProto\n Delimiters:\n - 'pb'\n - 'proto'\n EnclosingFunctions:\n - 'PARSE_TEXT_PROTO'\n BasedOnStyle: google\n - Language: Cpp\n Delimiters:\n - 'cc'\n - 'cpp'\n BasedOnStyle: llvm\n CanonicalDelimiter: 'cc'

Documentation\n" + "x-intellij-html-description": "RawStringFormats Documentation\n

Defines hints for detecting supported languages code blocks in raw\nstrings.\n

A raw string with a matching delimiter or a matching enclosing function\nname will be reformatted assuming the specified language based on the\nstyle for that language defined in the .clang-format file. If no style has\nbeen defined in the .clang-format file for the specific language, a\npredefined style given by BasedOnStyle is used. If BasedOnStyle is\nnot found, the formatting is based on LLVM style. A matching delimiter\ntakes precedence over a matching enclosing function name for determining\nthe language of the raw string contents.\n

If a canonical delimiter is specified, occurrences of other delimiters for\nthe same language will be updated to the canonical if possible.\n

There should be at most one specification per language and each delimiter\nand enclosing function should not occur in multiple specifications.\n

To configure this in the .clang-format file, use:\n\n

  RawStringFormats:\n    - Language: TextProto\n        Delimiters:\n          - pb\n          - proto\n        EnclosingFunctions:\n          - PARSE_TEXT_PROTO\n        BasedOnStyle: google\n    - Language: Cpp\n        Delimiters:\n          - cc\n          - cpp\n        BasedOnStyle: LLVM\n        CanonicalDelimiter: cc\n

From clang-format 6" }, "ReferenceAlignment": { "type": "string", @@ -1385,19 +1671,39 @@ "description": "Align reference in the middle." } }, - "x-intellij-html-description": "

Reference alignment style (overrides ``PointerAlignment`` for\nreferences).

Documentation\n" + "x-intellij-html-description": "ReferenceAlignment Documentation\n

Reference alignment style (overrides PointerAlignment for\nreferences).

From clang-format 13

Invoke completion to see all options" }, "ReflowComments": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, clang-format will attempt to re-flow comments. That is it\nwill touch a comment and *reflow* long comments into new lines, trying to\nobey the ``ColumnLimit``.\n

.. code-block:: c++\n

false:\n // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information\n /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */\n

true:\n // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of\n // information\n /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of\n * information */

Documentation\n" + "x-intellij-html-description": "ReflowComments Documentation\n

If true, clang-format will attempt to re-flow comments. That is it\nwill touch a comment and *reflow* long comments into new lines, trying to\nobey the ColumnLimit.\n\n

   false:\n   // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information\n   /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */\n\n   true:\n   // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of\n   // information\n   /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of\n    * information */\n

From clang-format 3.8" }, "RemoveBracesLLVM": { "type": "boolean", - "x-intellij-html-description": "

Remove optional braces of control statements (``if``, ``else``, ``for``,\nand ``while``) in C++ according to the LLVM coding style.\n

.. warning:: \n

This option will be renamed and expanded to support other styles.\n

.. warning:: \n

Setting this option to `true` could lead to incorrect code formatting due\n to clang-format's lack of complete semantic information. As such, extra\n care should be taken to review code changes made by this option.\n

.. code-block:: c++\n

false: true:\n

if (isa(D)) { vs. if (isa(D))\n handleFunctionDecl(D); handleFunctionDecl(D);\n } else if (isa(D)) { else if (isa(D))\n handleVarDecl(D); handleVarDecl(D);\n }\n

if (isa(D)) { vs. if (isa(D)) {\n for (auto *A : D.attrs()) { for (auto *A : D.attrs())\n if (shouldProcessAttr(A)) { if (shouldProcessAttr(A))\n handleAttr(A); handleAttr(A);\n } }\n }\n }\n

if (isa(D)) { vs. if (isa(D))\n for (auto *A : D.attrs()) { for (auto *A : D.attrs())\n handleAttr(A); handleAttr(A);\n }\n }\n

if (auto *D = (T)(D)) { vs. if (auto *D = (T)(D)) {\n if (shouldProcess(D)) { if (shouldProcess(D))\n handleVarDecl(D); handleVarDecl(D);\n } else { else\n markAsIgnored(D); markAsIgnored(D);\n } }\n }\n

if (a) { vs. if (a)\n b(); b();\n } else { else if (c)\n if (c) { d();\n d(); else\n } else { e();\n e();\n }\n }

Documentation\n" + "x-intellij-html-description": "RemoveBracesLLVM Documentation\n

Remove optional braces of control statements (if, else, for,\nand while) in C++ according to the LLVM coding style.\nWarning: This option will be renamed and expanded to support other styles.\nWarning: Setting this option to true could lead to incorrect code formatting\n due to clang-format's lack of complete semantic information. As such,\n extra care should be taken to review code changes made by this option.\n\n

  false:                                     true:\n\n  if (isa<FunctionDecl>(D)) {        vs.     if (isa<FunctionDecl>(D))\n    handleFunctionDecl(D);                     handleFunctionDecl(D);\n  } else if (isa<VarDecl>(D)) {              else if (isa<VarDecl>(D))\n    handleVarDecl(D);                          handleVarDecl(D);\n  }\n\n  if (isa<VarDecl>(D)) {             vs.     if (isa<VarDecl>(D)) {\n    for (auto *A : D.attrs()) {                for (auto *A : D.attrs())\n      if (shouldProcessAttr(A)) {                if (shouldProcessAttr(A))\n        handleAttr(A);                             handleAttr(A);\n      }                                      }\n    }\n  }\n\n  if (isa<FunctionDecl>(D)) {        vs.     if (isa<FunctionDecl>(D))\n    for (auto *A : D.attrs()) {                for (auto *A : D.attrs())\n      handleAttr(A);                             handleAttr(A);\n    }\n  }\n\n  if (auto *D = (T)(D)) {            vs.     if (auto *D = (T)(D)) {\n    if (shouldProcess(D)) {                    if (shouldProcess(D))\n      handleVarDecl(D);                          handleVarDecl(D);\n    } else {                                   else\n      markAsIgnored(D);                          markAsIgnored(D);\n    }                                        }\n  }\n\n  if (a) {                           vs.     if (a)\n    b();                                       b();\n  } else {                                   else if (c)\n    if (c) {                                   d();\n      d();                                   else\n    } else {                                   e();\n      e();\n    }\n  }\n

From clang-format 14" + }, + "RemoveParentheses": { + "type": "string", + "enum": [ + "Leave", + "MultipleParentheses", + "ReturnStatement" + ], + "x-intellij-enum-metadata": { + "Leave": { + "description": "Do not remove parentheses." + }, + "MultipleParentheses": { + "description": "Replace multiple parentheses with single parentheses." + }, + "ReturnStatement": { + "description": "Also remove parentheses enclosing the expression in a" + } + }, + "x-intellij-html-description": "RemoveParentheses Documentation\n

Remove redundant parentheses.\nWarning: Setting this option to any value other than Leave could lead to\n incorrect code formatting due to clang-format's lack of complete semantic\n information. As such, extra care should be taken to review code changes\n made by this option.

From clang-format 17

Invoke completion to see all options" }, "RemoveSemicolon": { "type": "boolean", - "x-intellij-html-description": "

Remove semicolons after the closing brace of a non-empty function.\n

.. warning:: \n

Setting this option to `true` could lead to incorrect code formatting due\n to clang-format's lack of complete semantic information. As such, extra\n care should be taken to review code changes made by this option.\n

.. code-block:: c++\n

false: true:\n

int max(int a, int b) { int max(int a, int b) {\n return a > b ? a : b; return a > b ? a : b;\n }; }

Documentation\n" + "x-intellij-html-description": "RemoveSemicolon Documentation\n

Remove semicolons after the closing braces of functions and\nconstructors/destructors.\nWarning: Setting this option to true could lead to incorrect code formatting\n due to clang-format's lack of complete semantic information. As such,\n extra care should be taken to review code changes made by this option.\n\n

  false:                                     true:\n\n  int max(int a, int b) {                    int max(int a, int b) {\n    return a > b ? a : b;                      return a > b ? a : b;\n  };                                         }\n\n

From clang-format 16" }, "RequiresClausePosition": { "type": "string", @@ -1421,7 +1727,7 @@ "description": "Try to put everything in the same line if possible. Otherwise normal" } }, - "x-intellij-html-description": "

The position of the ``requires`` clause.

Documentation\n" + "x-intellij-html-description": "RequiresClausePosition Documentation\n

The position of the requires clause.

From clang-format 15

Invoke completion to see all options" }, "RequiresExpressionIndentation": { "type": "string", @@ -1434,10 +1740,10 @@ "description": "Align requires expression body relative to the indentation level of the" }, "Keyword": { - "description": "Align requires expression body relative to the `requires` keyword." + "description": "Align requires expression body relative to the ``requires`` keyword." } }, - "x-intellij-html-description": "

The indentation used for requires expression bodies.

Documentation\n" + "x-intellij-html-description": "RequiresExpressionIndentation Documentation\n

The indentation used for requires expression bodies.

From clang-format 16

Invoke completion to see all options" }, "SeparateDefinitionBlocks": { "type": "string", @@ -1457,11 +1763,15 @@ "description": "Remove any empty line between definition blocks." } }, - "x-intellij-html-description": "

Specifies the use of empty lines to separate definition blocks, including\nclasses, structs, enums, and functions.\n

.. code-block:: c++\n

Never v.s. Always\n #include #include \n struct Foo {\n int a, b, c; struct Foo {\n }; int a, b, c;\n namespace Ns { };\n class Bar {\n public: namespace Ns {\n struct Foobar { class Bar {\n int a; public:\n int b; struct Foobar {\n }; int a;\n private: int b;\n int t; };\n int method1() {\n // ... private:\n } int t;\n enum List {\n ITEM1, int method1() {\n ITEM2 // ...\n }; }\n template\n int method2(T x) { enum List {\n // ... ITEM1,\n } ITEM2\n int i, j, k; };\n int method3(int par) {\n // ... template\n } int method2(T x) {\n }; // ...\n class C {}; }\n }\n int i, j, k;\n

int method3(int par) {\n // ...\n }\n };\n

class C {};\n }

Documentation\n" + "x-intellij-html-description": "SeparateDefinitionBlocks Documentation\n

Specifies the use of empty lines to separate definition blocks, including\nclasses, structs, enums, and functions.\n\n

   Never                  v.s.     Always\n   #include <cstring>              #include <cstring>\n   struct Foo {\n     int a, b, c;                  struct Foo {\n   };                                int a, b, c;\n   namespace Ns {                  };\n   class Bar {\n   public:                         namespace Ns {\n     struct Foobar {               class Bar {\n       int a;                      public:\n       int b;                        struct Foobar {\n     };                                int a;\n   private:                            int b;\n     int t;                          };\n     int method1() {\n       // ...                      private:\n     }                               int t;\n     enum List {\n       ITEM1,                        int method1() {\n       ITEM2                           // ...\n     };                              }\n     template<typename T>\n     int method2(T x) {              enum List {\n       // ...                          ITEM1,\n     }                                 ITEM2\n     int i, j, k;                    };\n     int method3(int par) {\n       // ...                        template<typename T>\n     }                               int method2(T x) {\n   };                                  // ...\n   class C {};                       }\n   }\n                                     int i, j, k;\n\n                                     int method3(int par) {\n                                       // ...\n                                     }\n                                   };\n\n                                   class C {};\n                                   }\n

From clang-format 14

Invoke completion to see all options" }, "ShortNamespaceLines": { "type": "number", - "x-intellij-html-description": "

The maximal number of unwrapped lines that a short namespace spans.\nDefaults to 1.\n

This determines the maximum length of short namespaces by counting\nunwrapped lines (i.e. containing neither opening nor closing\nnamespace brace) and makes \"FixNamespaceComments\" omit adding\nend comments for those.\n

.. code-block:: c++\n

ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0\n namespace a { namespace a {\n int foo; int foo;\n } } // namespace a\n

ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0\n namespace b { namespace b {\n int foo; int foo;\n int bar; int bar;\n } // namespace b } // namespace b

Documentation\n" + "x-intellij-html-description": "ShortNamespaceLines Documentation\n

The maximal number of unwrapped lines that a short namespace spans.\nDefaults to 1.\n

This determines the maximum length of short namespaces by counting\nunwrapped lines (i.e. containing neither opening nor closing\nnamespace brace) and makes FixNamespaceComments omit adding\nend comments for those.\n\n

   ShortNamespaceLines: 1     vs.     ShortNamespaceLines: 0\n   namespace a {                      namespace a {\n     int foo;                           int foo;\n   }                                  } // namespace a\n\n   ShortNamespaceLines: 1     vs.     ShortNamespaceLines: 0\n   namespace b {                      namespace b {\n     int foo;                           int foo;\n     int bar;                           int bar;\n   } // namespace b                   } // namespace b\n

From clang-format 13" + }, + "SkipMacroDefinitionBody": { + "type": "boolean", + "x-intellij-html-description": "SkipMacroDefinitionBody Documentation\n

Do not format macro definition body.

From clang-format 18" }, "SortIncludes": { "type": "string", @@ -1481,7 +1791,7 @@ "description": "Includes are sorted in an alphabetical or case insensitive fashion." } }, - "x-intellij-html-description": "

Controls if and how clang-format will sort ``#includes``.\nIf ``Never``, includes are never sorted.\nIf ``CaseInsensitive``, includes are sorted in an ASCIIbetical or case\ninsensitive fashion.\nIf ``CaseSensitive``, includes are sorted in an alphabetical or case\nsensitive fashion.

Documentation\n" + "x-intellij-html-description": "SortIncludes Documentation\n

Controls if and how clang-format will sort #includes.

From clang-format 3.8

Invoke completion to see all options" }, "SortJavaStaticImport": { "type": "string", @@ -1497,23 +1807,39 @@ "description": "Static imports are placed after non-static imports." } }, - "x-intellij-html-description": "

When sorting Java imports, by default static imports are placed before\nnon-static imports. If ``JavaStaticImportAfterImport`` is ``After``,\nstatic imports are placed after non-static imports.

Documentation\n" + "x-intellij-html-description": "SortJavaStaticImport Documentation\n

When sorting Java imports, by default static imports are placed before\nnon-static imports. If JavaStaticImportAfterImport is After,\nstatic imports are placed after non-static imports.

From clang-format 12

Invoke completion to see all options" }, "SortUsingDeclarations": { - "type": "boolean", - "x-intellij-html-description": "

If ``true``, clang-format will sort using declarations.\n

The order of using declarations is defined as follows:\nSplit the strings by \"::\" and discard any initial empty strings. The last\nelement of each list is a non-namespace name; all others are namespace\nnames. Sort the lists of names lexicographically, where the sort order of\nindividual names is that all non-namespace names come before all namespace\nnames, and within those groups, names are in case-insensitive\nlexicographic order.\n

.. code-block:: c++\n

false: true:\n using std::cout; vs. using std::cin;\n using std::cin; using std::cout;

Documentation\n" + "type": "string", + "enum": [ + "Never", + "Lexicographic", + "LexicographicNumeric" + ], + "x-intellij-enum-metadata": { + "Never": { + "description": "Using declarations are never sorted." + }, + "Lexicographic": { + "description": "Using declarations are sorted in the order defined as follows:" + }, + "LexicographicNumeric": { + "description": "Using declarations are sorted in the order defined as follows:" + } + }, + "x-intellij-html-description": "SortUsingDeclarations Documentation\n

Controls if and how clang-format will sort using declarations.

From clang-format 5

Invoke completion to see all options" }, "SpaceAfterCStyleCast": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, a space is inserted after C style casts.\n

.. code-block:: c++\n

true: false:\n (int) i; vs. (int)i;

Documentation\n" + "x-intellij-html-description": "SpaceAfterCStyleCast Documentation\n

If true, a space is inserted after C style casts.\n\n

   true:                                  false:\n   (int) i;                       vs.     (int)i;\n

From clang-format 3.5" }, "SpaceAfterLogicalNot": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, a space is inserted after the logical not operator (``!``).\n

.. code-block:: c++\n

true: false:\n ! someExpression(); vs. !someExpression();

Documentation\n" + "x-intellij-html-description": "SpaceAfterLogicalNot Documentation\n

If true, a space is inserted after the logical not operator (!).\n\n

   true:                                  false:\n   ! someExpression();            vs.     !someExpression();\n

From clang-format 9" }, "SpaceAfterTemplateKeyword": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, a space will be inserted after the 'template' keyword.\n

.. code-block:: c++\n

true: false:\n template void foo(); vs. template void foo();

Documentation\n" + "x-intellij-html-description": "SpaceAfterTemplateKeyword Documentation\n

If true, a space will be inserted after the template keyword.\n\n

   true:                                  false:\n   template <int> void foo();     vs.     template<int> void foo();\n

From clang-format 4" }, "SpaceAroundPointerQualifiers": { "type": "string", @@ -1537,27 +1863,31 @@ "description": "Ensure that there is a space both before and after pointer qualifiers." } }, - "x-intellij-html-description": "

Defines in which cases to put a space before or after pointer qualifiers

Documentation\n" + "x-intellij-html-description": "SpaceAroundPointerQualifiers Documentation\n

Defines in which cases to put a space before or after pointer qualifiers

From clang-format 12

Invoke completion to see all options" }, "SpaceBeforeAssignmentOperators": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, spaces will be removed before assignment operators.\n

.. code-block:: c++\n

true: false:\n int a = 5; vs. int a= 5;\n a += 42; a+= 42;

Documentation\n" + "x-intellij-html-description": "SpaceBeforeAssignmentOperators Documentation\n

If false, spaces will be removed before assignment operators.\n\n

   true:                                  false:\n   int a = 5;                     vs.     int a= 5;\n   a += 42;                               a+= 42;\n

From clang-format 3.7" }, "SpaceBeforeCaseColon": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, spaces will be removed before case colon.\n

.. code-block:: c++\n

true: false\n switch (x) { vs. switch (x) {\n case 1 : break; case 1: break;\n } }

Documentation\n" + "x-intellij-html-description": "SpaceBeforeCaseColon Documentation\n

If false, spaces will be removed before case colon.\n\n

  true:                                   false\n  switch (x) {                    vs.     switch (x) {\n    case 1 : break;                         case 1: break;\n  }                                       }\n

From clang-format 12" }, "SpaceBeforeCpp11BracedList": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, a space will be inserted before a C++11 braced list\nused to initialize an object (after the preceding identifier or type).\n

.. code-block:: c++\n

true: false:\n Foo foo { bar }; vs. Foo foo{ bar };\n Foo {}; Foo{};\n vector { 1, 2, 3 }; vector{ 1, 2, 3 };\n new int[3] { 1, 2, 3 }; new int[3]{ 1, 2, 3 };

Documentation\n" + "x-intellij-html-description": "SpaceBeforeCpp11BracedList Documentation\n

If true, a space will be inserted before a C++11 braced list\nused to initialize an object (after the preceding identifier or type).\n\n

   true:                                  false:\n   Foo foo { bar };               vs.     Foo foo{ bar };\n   Foo {};                                Foo{};\n   vector<int> { 1, 2, 3 };               vector<int>{ 1, 2, 3 };\n   new int[3] { 1, 2, 3 };                new int[3]{ 1, 2, 3 };\n

From clang-format 7" }, "SpaceBeforeCtorInitializerColon": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, spaces will be removed before constructor initializer\ncolon.\n

.. code-block:: c++\n

true: false:\n Foo::Foo() : a(a) {} Foo::Foo(): a(a) {}

Documentation\n" + "x-intellij-html-description": "SpaceBeforeCtorInitializerColon Documentation\n

If false, spaces will be removed before constructor initializer\ncolon.\n\n

   true:                                  false:\n   Foo::Foo() : a(a) {}                   Foo::Foo(): a(a) {}\n

From clang-format 7" }, "SpaceBeforeInheritanceColon": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, spaces will be removed before inheritance colon.\n

.. code-block:: c++\n

true: false:\n class Foo : Bar {} vs. class Foo: Bar {}

Documentation\n" + "x-intellij-html-description": "SpaceBeforeInheritanceColon Documentation\n

If false, spaces will be removed before inheritance colon.\n\n

   true:                                  false:\n   class Foo : Bar {}             vs.     class Foo: Bar {}\n

From clang-format 7" + }, + "SpaceBeforeJsonColon": { + "type": "boolean", + "x-intellij-html-description": "SpaceBeforeJsonColon Documentation\n

If true, a space will be added before a JSON colon. For other\nlanguages, e.g. JavaScript, use SpacesInContainerLiterals instead.\n\n

   true:                                  false:\n   {                                      {\n     \"key\" : \"value\"              vs.       \"key\": \"value\"\n   }                                      }\n

From clang-format 17" }, "SpaceBeforeParens": { "type": "string", @@ -1571,7 +1901,7 @@ ], "x-intellij-enum-metadata": { "Never": { - "description": "Never put a space before opening parentheses." + "description": "This is **deprecated** and replaced by ``Custom`` below, with all" }, "ControlStatements": { "description": "Put a space before opening parentheses only after control statement" @@ -1589,7 +1919,7 @@ "description": "Configure each individual space before parentheses in" } }, - "x-intellij-html-description": "

Defines in which cases to put a space before opening parentheses.

Documentation\n" + "x-intellij-html-description": "SpaceBeforeParens Documentation\n

Defines in which cases to put a space before opening parentheses.

From clang-format 3.5

Invoke completion to see all options" }, "SpaceBeforeParensOptions": { "type": "object", @@ -1597,62 +1927,66 @@ "properties": { "AfterControlStatements": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put space betwee control statement keywords\n(for/if/while...) and opening parentheses.\n

.. code-block:: c++\n

true: false:\n if (...) {} vs. if(...) {}" + "x-intellij-html-description": "If true, put space between control statement keywords\n(for/if/while...) and opening parentheses.\n\n

   true:                                  false:\n   if (...) {}                     vs.    if(...) {}\n

SpaceBeforeParensOptions Documentation\n" }, "AfterForeachMacros": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put space between foreach macros and opening parentheses.\n

.. code-block:: c++\n

true: false:\n FOREACH (...) vs. FOREACH(...)\n " + "x-intellij-html-description": "If true, put space between foreach macros and opening parentheses.\n\n

   true:                                  false:\n   FOREACH (...)                   vs.    FOREACH(...)\n     <loop-body>                            <loop-body>\n

SpaceBeforeParensOptions Documentation\n" }, "AfterFunctionDeclarationName": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put a space between function declaration name and opening\nparentheses.\n

.. code-block:: c++\n

true: false:\n void f (); vs. void f();" + "x-intellij-html-description": "If true, put a space between function declaration name and opening\nparentheses.\n\n

   true:                                  false:\n   void f ();                      vs.    void f();\n

SpaceBeforeParensOptions Documentation\n" }, "AfterFunctionDefinitionName": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put a space between function definition name and opening\nparentheses.\n

.. code-block:: c++\n

true: false:\n void f () {} vs. void f() {}" + "x-intellij-html-description": "If true, put a space between function definition name and opening\nparentheses.\n\n

   true:                                  false:\n   void f () {}                    vs.    void f() {}\n

SpaceBeforeParensOptions Documentation\n" }, "AfterIfMacros": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put space between if macros and opening parentheses.\n

.. code-block:: c++\n

true: false:\n IF (...) vs. IF(...)\n " + "x-intellij-html-description": "If true, put space between if macros and opening parentheses.\n\n

   true:                                  false:\n   IF (...)                        vs.    IF(...)\n     <conditional-body>                     <conditional-body>\n

SpaceBeforeParensOptions Documentation\n" }, "AfterOverloadedOperator": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put a space between operator overloading and opening\nparentheses.\n

.. code-block:: c++\n

true: false:\n void operator++ (int a); vs. void operator++(int a);\n object.operator++ (10); object.operator++(10);" + "x-intellij-html-description": "If true, put a space between operator overloading and opening\nparentheses.\n\n

   true:                                  false:\n   void operator++ (int a);        vs.    void operator++(int a);\n   object.operator++ (10);                object.operator++(10);\n

SpaceBeforeParensOptions Documentation\n" + }, + "AfterPlacementOperator": { + "type": "boolean", + "x-intellij-html-description": "If true, put a space between operator new/delete and opening\nparenthesis.\n\n

   true:                                  false:\n   new (buf) T;                    vs.    new(buf) T;\n   delete (buf) T;                        delete(buf) T;\n

SpaceBeforeParensOptions Documentation\n" }, "AfterRequiresInClause": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put space between requires keyword in a requires clause and\nopening parentheses, if there is one.\n

.. code-block:: c++\n

true: false:\n template vs. template\n requires (A && B) requires(A && B)\n ... ..." + "x-intellij-html-description": "If true, put space between requires keyword in a requires clause and\nopening parentheses, if there is one.\n\n

   true:                                  false:\n   template<typename T>            vs.    template<typename T>\n   requires (A<T> && B<T>)                requires(A<T> && B<T>)\n   ...                                    ...\n

SpaceBeforeParensOptions Documentation\n" }, "AfterRequiresInExpression": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put space between requires keyword in a requires expression\nand opening parentheses.\n

.. code-block:: c++\n

true: false:\n template vs. template\n concept C = requires (T t) { concept C = requires(T t) {\n ... ...\n } }" + "x-intellij-html-description": "If true, put space between requires keyword in a requires expression\nand opening parentheses.\n\n

   true:                                  false:\n   template<typename T>            vs.    template<typename T>\n   concept C = requires (T t) {           concept C = requires(T t) {\n                 ...                                    ...\n               }                                      }\n

SpaceBeforeParensOptions Documentation\n" }, "BeforeNonEmptyParentheses": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, put a space before opening parentheses only if the\nparentheses are not empty.\n

.. code-block:: c++\n

true: false:\n void f (int a); vs. void f();\n f (a); f();" + "x-intellij-html-description": "If true, put a space before opening parentheses only if the\nparentheses are not empty.\n\n

   true:                                  false:\n   void f (int a);                 vs.    void f();\n   f (a);                                 f();\n

SpaceBeforeParensOptions Documentation\n" } }, - "x-intellij-html-description": "

Control of individual space before parentheses.\n

If ``SpaceBeforeParens`` is set to ``Custom``, use this to specify\nhow each individual space before parentheses case should be handled.\nOtherwise, this is ignored.\n

.. code-block:: yaml\n

# Example of usage:\n SpaceBeforeParens: Custom\n SpaceBeforeParensOptions:\n AfterControlStatements: true\n AfterFunctionDefinitionName: true

Documentation\n" + "x-intellij-html-description": "SpaceBeforeParensOptions Documentation\n

Control of individual space before parentheses.\n

If SpaceBeforeParens is set to Custom, use this to specify\nhow each individual space before parentheses case should be handled.\nOtherwise, this is ignored.\n\n

  # Example of usage:\n  SpaceBeforeParens: Custom\n  SpaceBeforeParensOptions:\n    AfterControlStatements: true\n    AfterFunctionDefinitionName: true\n

Precise control over the spacing before parentheses.\n\n

  # Should be declared this way:\n  SpaceBeforeParens: Custom\n  SpaceBeforeParensOptions:\n    AfterControlStatements: true\n    AfterFunctionDefinitionName: true\n

From clang-format 14" }, "SpaceBeforeRangeBasedForLoopColon": { "type": "boolean", - "x-intellij-html-description": "

If ``false``, spaces will be removed before range-based for loop\ncolon.\n

.. code-block:: c++\n

true: false:\n for (auto v : values) {} vs. for(auto v: values) {}

Documentation\n" + "x-intellij-html-description": "SpaceBeforeRangeBasedForLoopColon Documentation\n

If false, spaces will be removed before range-based for loop\ncolon.\n\n

   true:                                  false:\n   for (auto v : values) {}       vs.     for(auto v: values) {}\n

From clang-format 7" }, "SpaceBeforeSquareBrackets": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces will be before ``[``.\nLambdas will not be affected. Only the first ``[`` will get a space added.\n

.. code-block:: c++\n

true: false:\n int a [5]; vs. int a[5];\n int a [5][5]; vs. int a[5][5];

Documentation\n" + "x-intellij-html-description": "SpaceBeforeSquareBrackets Documentation\n

If true, spaces will be before [.\nLambdas will not be affected. Only the first [ will get a space added.\n\n

   true:                                  false:\n   int a [5];                    vs.      int a[5];\n   int a [5][5];                 vs.      int a[5][5];\n

From clang-format 10" }, "SpaceInEmptyBlock": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces will be inserted into ``{}``.\n

.. code-block:: c++\n

true: false:\n void f() { } vs. void f() {}\n while (true) { } while (true) {}

Documentation\n" + "x-intellij-html-description": "SpaceInEmptyBlock Documentation\n

If true, spaces will be inserted into {}.\n\n

   true:                                false:\n   void f() { }                   vs.   void f() {}\n   while (true) { }                     while (true) {}\n

From clang-format 10" }, "SpaceInEmptyParentheses": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces may be inserted into ``()``.\n

.. code-block:: c++\n

true: false:\n void f( ) { vs. void f() {\n int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()};\n if (true) { if (true) {\n f( ); f();\n } }\n } }

Documentation\n" + "x-intellij-html-description": "SpaceInEmptyParentheses Documentation\n

If true, spaces may be inserted into ().\nThis option is **deprecated**. See InEmptyParentheses of\nSpacesInParensOptions.

From clang-format 3.7" }, "SpacesBeforeTrailingComments": { "type": "number", - "x-intellij-html-description": "

The number of spaces before trailing line comments\n(``//`` - comments).\n

This does not affect trailing block comments (``/*`` - comments) as\nthose commonly have different usage patterns and a number of special\ncases.\n

.. code-block:: c++\n

SpacesBeforeTrailingComments: 3\n void f() {\n if (true) { // foo1\n f(); // bar\n } // foo\n }

Documentation\n" + "x-intellij-html-description": "SpacesBeforeTrailingComments Documentation\n

The number of spaces before trailing line comments\n(// - comments).\n

This does not affect trailing block comments (/* - comments) as those\ncommonly have different usage patterns and a number of special cases. In\nthe case of Verilog, it doesn't affect a comment right after the opening\nparenthesis in the port or parameter list in a module header, because it\nis probably for the port on the following line instead of the parenthesis\nit follows.\n\n

   SpacesBeforeTrailingComments: 3\n   void f() {\n     if (true) {   // foo1\n       f();        // bar\n     }             // foo\n   }\n

From clang-format 3.7" }, "SpacesInAngles": { "type": "string", @@ -1672,42 +2006,85 @@ "description": "Keep a single space after ```` if any spaces were" } }, - "x-intellij-html-description": "

The SpacesInAnglesStyle to use for template argument lists.

Documentation\n" + "x-intellij-html-description": "SpacesInAngles Documentation\n

The SpacesInAnglesStyle to use for template argument lists.

From clang-format 3.4

Invoke completion to see all options" }, "SpacesInCStyleCastParentheses": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces may be inserted into C style casts.\n

.. code-block:: c++\n

true: false:\n x = ( int32 )y vs. x = (int32)y

Documentation\n" + "x-intellij-html-description": "SpacesInCStyleCastParentheses Documentation\n

If true, spaces may be inserted into C style casts.\nThis option is **deprecated**. See InCStyleCasts of\nSpacesInParensOptions.

From clang-format 3.7" }, "SpacesInConditionalStatement": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces will be inserted around if/for/switch/while\nconditions.\n

.. code-block:: c++\n

true: false:\n if ( a ) { ... } vs. if (a) { ... }\n while ( i < 5 ) { ... } while (i < 5) { ... }

Documentation\n" + "x-intellij-html-description": "SpacesInConditionalStatement Documentation\n

If true, spaces will be inserted around if/for/switch/while\nconditions.\nThis option is **deprecated**. See InConditionalStatements of\nSpacesInParensOptions.

From clang-format 10" }, "SpacesInContainerLiterals": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces are inserted inside container literals (e.g.\nObjC and Javascript array and dict literals).\n

.. code-block:: js\n

true: false:\n var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3];\n f({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3});

Documentation\n" + "x-intellij-html-description": "SpacesInContainerLiterals Documentation\n

If true, spaces are inserted inside container literals (e.g. ObjC and\nJavascript array and dict literals). For JSON, use\nSpaceBeforeJsonColon instead.\n\n

   true:                                  false:\n   var arr = [ 1, 2, 3 ];         vs.     var arr = [1, 2, 3];\n   f({a : 1, b : 2, c : 3});              f({a: 1, b: 2, c: 3});\n

From clang-format 3.7" }, "SpacesInLineCommentPrefix": { "type": "object", "additionalProperties": false, "properties": { - "Minimum": { + "Maximum": { "type": "number", - "x-intellij-html-description": "

The minimum number of spaces at the start of the comment." + "x-intellij-html-description": "The maximum number of spaces at the start of the comment.

SpacesInLineCommentPrefix Documentation\n" }, - "Maximum": { + "Minimum": { "type": "number", - "x-intellij-html-description": "

The maximum number of spaces at the start of the comment." + "x-intellij-html-description": "The minimum number of spaces at the start of the comment.

SpacesInLineCommentPrefix Documentation\n" + } + }, + "x-intellij-html-description": "SpacesInLineCommentPrefix Documentation\n

How many spaces are allowed at the start of a line comment. To disable the\nmaximum set it to -1, apart from that the maximum takes precedence\nover the minimum.\n\n

  Minimum = 1\n  Maximum = -1\n  // One space is forced\n\n  //  but more spaces are possible\n\n  Minimum = 0\n  Maximum = 0\n  //Forces to start every comment directly after the slashes\n
\n

Note that in line comment sections the relative indent of the subsequent\nlines is kept, that means the following:\n\n

  before:                                   after:\n  Minimum: 1\n  //if (b) {                                // if (b) {\n  //  return true;                          //   return true;\n  //}                                       // }\n\n  Maximum: 0\n  /// List:                                 ///List:\n  ///  - Foo                                /// - Foo\n  ///    - Bar                              ///   - Bar\n
\n

This option has only effect if ReflowComments is set to true.

Control of spaces within a single line comment.

From clang-format 13" + }, + "SpacesInParens": { + "type": "string", + "enum": [ + "Never", + "Custom" + ], + "x-intellij-enum-metadata": { + "Never": { + "description": "Never put a space in parentheses." + }, + "Custom": { + "description": "Configure each individual space in parentheses in" } }, - "x-intellij-html-description": "

How many spaces are allowed at the start of a line comment. To disable the\nmaximum set it to ``-1``, apart from that the maximum takes precedence\nover the minimum.\n

.. code-block:: c++\n

Minimum = 1\n Maximum = -1\n // One space is forced\n

// but more spaces are possible\n

Minimum = 0\n Maximum = 0\n //Forces to start every comment directly after the slashes\n

Note that in line comment sections the relative indent of the subsequent\nlines is kept, that means the following:\n

.. code-block:: c++\n

before: after:\n Minimum: 1\n //if (b) { // if (b) {\n // return true; // return true;\n //} // }\n

Maximum: 0\n /// List: ///List:\n /// - Foo /// - Foo\n /// - Bar /// - Bar\n

This option has only effect if ``ReflowComments`` is set to ``true``.

Documentation\n" + "x-intellij-html-description": "SpacesInParens Documentation\n

Defines in which cases spaces will be inserted after ( and before\n).

From clang-format 17

Invoke completion to see all options" + }, + "SpacesInParensOptions": { + "type": "object", + "additionalProperties": false, + "properties": { + "ExceptDoubleParentheses": { + "type": "boolean", + "x-intellij-html-description": "Override any of the following options to prevent addition of space\nwhen both opening and closing parentheses use multiple parentheses.\n\n

  true:\n  __attribute__(( noreturn ))\n  __decltype__(( x ))\n  if (( a = b ))\n
\n false:\n Uses the applicable option.

SpacesInParensOptions Documentation\n" + }, + "InCStyleCasts": { + "type": "boolean", + "x-intellij-html-description": "Put a space in C style casts.\n\n

  true:                                  false:\n  x = ( int32 )y                  vs.    x = (int32)y\n  y = (( int (*)(int) )foo)(x);          y = ((int (*)(int))foo)(x);\n

SpacesInParensOptions Documentation\n" + }, + "InConditionalStatements": { + "type": "boolean", + "x-intellij-html-description": "Put a space in parentheses only inside conditional statements\n(for/if/while/switch...).\n\n

   true:                                  false:\n   if ( a )  { ... }              vs.     if (a) { ... }\n   while ( i < 5 )  { ... }               while (i < 5) { ... }\n

SpacesInParensOptions Documentation\n" + }, + "InEmptyParentheses": { + "type": "boolean", + "x-intellij-html-description": "Insert a space in empty parentheses, i.e. ().\n\n

   true:                                false:\n   void f( ) {                    vs.   void f() {\n     int x[] = {foo( ), bar( )};          int x[] = {foo(), bar()};\n     if (true) {                          if (true) {\n       f( );                                f();\n     }                                    }\n   }                                    }\n

SpacesInParensOptions Documentation\n" + }, + "Other": { + "type": "boolean", + "x-intellij-html-description": "Put a space in parentheses not covered by preceding options.\n\n

  true:                                 false:\n  t f( Deleted & ) & = delete;    vs.   t f(Deleted &) & = delete;\n

SpacesInParensOptions Documentation\n" + } + }, + "x-intellij-html-description": "SpacesInParensOptions Documentation\n

Control of individual spaces in parentheses.\n

If SpacesInParens is set to Custom, use this to specify\nhow each individual space in parentheses case should be handled.\nOtherwise, this is ignored.\n\n

  # Example of usage:\n  SpacesInParens: Custom\n  SpacesInParensOptions:\n    ExceptDoubleParentheses: false\n    InConditionalStatements: true\n    InEmptyParentheses: true\n

Precise control over the spacing in parentheses.\n\n

  # Should be declared this way:\n  SpacesInParens: Custom\n  SpacesInParensOptions:\n    ExceptDoubleParentheses: false\n    InConditionalStatements: true\n    Other: true\n

From clang-format 17" }, "SpacesInParentheses": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces will be inserted after ``(`` and before ``)``.\n

.. code-block:: c++\n

true: false:\n t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;

Documentation\n" + "x-intellij-html-description": "SpacesInParentheses Documentation\n

If true, spaces will be inserted after ( and before ).\nThis option is **deprecated**. The previous behavior is preserved by using\nSpacesInParens with Custom and by setting all\nSpacesInParensOptions to true except for InCStyleCasts and\nInEmptyParentheses.

From clang-format 3.7" }, "SpacesInSquareBrackets": { "type": "boolean", - "x-intellij-html-description": "

If ``true``, spaces will be inserted after ``[`` and before ``]``.\nLambdas without arguments or unspecified size array declarations will not\nbe affected.\n

.. code-block:: c++\n

true: false:\n int a[ 5 ]; vs. int a[5];\n std::unique_ptr foo() {} // Won't be affected

Documentation\n" + "x-intellij-html-description": "SpacesInSquareBrackets Documentation\n

If true, spaces will be inserted after [ and before ].\nLambdas without arguments or unspecified size array declarations will not\nbe affected.\n\n

   true:                                  false:\n   int a[ 5 ];                    vs.     int a[5];\n   std::unique_ptr<int[]> foo() {} // Won't be affected\n

From clang-format 3.7" }, "Standard": { "type": "string", @@ -1743,36 +2120,70 @@ "description": "Automatic detection based on the input." } }, - "x-intellij-html-description": "

Parse and format C++ constructs compatible with this standard.\n

.. code-block:: c++\n

c++03: latest:\n vector > x; vs. vector> x;

Documentation\n" + "x-intellij-html-description": "Standard Documentation\n

Parse and format C++ constructs compatible with this standard.\n\n

   c++03:                                 latest:\n   vector<set<int> > x;           vs.     vector<set<int>> x;\n

From clang-format 3.7

Invoke completion to see all options" }, "StatementAttributeLikeMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

Macros which are ignored in front of a statement, as if they were an\nattribute. So that they are not parsed as identifier, for example for Qts\nemit.\n

.. code-block:: c++\n

AlignConsecutiveDeclarations: true\n StatementAttributeLikeMacros: []\n unsigned char data = 'x';\n emit signal(data); // This is parsed as variable declaration.\n

AlignConsecutiveDeclarations: true\n StatementAttributeLikeMacros: [emit]\n unsigned char data = 'x';\n emit signal(data); // Now it's fine again.

Documentation\n" + "x-intellij-html-description": "StatementAttributeLikeMacros Documentation\n

Macros which are ignored in front of a statement, as if they were an\nattribute. So that they are not parsed as identifier, for example for Qts\nemit.\n\n

  AlignConsecutiveDeclarations: true\n  StatementAttributeLikeMacros: []\n  unsigned char data = 'x';\n  emit          signal(data); // This is parsed as variable declaration.\n\n  AlignConsecutiveDeclarations: true\n  StatementAttributeLikeMacros: [emit]\n  unsigned char data = 'x';\n  emit signal(data); // Now it's fine again.\n

From clang-format 12" }, "StatementMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of macros that should be interpreted as complete\nstatements.\n

Typical macros are expressions, and require a semi-colon to be\nadded; sometimes this is not the case, and this allows to make\nclang-format aware of such cases.\n

For example: Q_UNUSED

Documentation\n" + "x-intellij-html-description": "StatementMacros Documentation\n

A vector of macros that should be interpreted as complete\nstatements.\n

Typical macros are expressions, and require a semi-colon to be\nadded; sometimes this is not the case, and this allows to make\nclang-format aware of such cases.\n

For example: Q_UNUSED

From clang-format 8" }, "TabWidth": { "type": "number", - "x-intellij-html-description": "

The number of columns used for tab stops.

Documentation\n" + "x-intellij-html-description": "TabWidth Documentation\n

The number of columns used for tab stops.

From clang-format 3.7" + }, + "TableGenBreakInsideDAGArg": { + "type": "string", + "enum": [ + "DontBreak", + "BreakElements", + "BreakAll" + ], + "x-intellij-enum-metadata": { + "DontBreak": { + "description": "Never break inside DAGArg." + }, + "BreakElements": { + "description": "Break inside DAGArg after each list element but for the last." + }, + "BreakAll": { + "description": "Break inside DAGArg after the operator and the all elements." + } + }, + "x-intellij-html-description": "TableGenBreakInsideDAGArg Documentation\n

The styles of the line break inside the DAGArg in TableGen.

From clang-format 19

Invoke completion to see all options" + }, + "TableGenBreakingDAGArgOperators": { + "type": "array", + "items": { + "type": "string" + }, + "x-intellij-html-description": "TableGenBreakingDAGArgOperators Documentation\n

Works only when TableGenBreakInsideDAGArg is not DontBreak.\nThe string list needs to consist of identifiers in TableGen.\nIf any identifier is specified, this limits the line breaks by\nTableGenBreakInsideDAGArg option only on DAGArg values beginning with\nthe specified identifiers.\n

For example the configuration,\n\n

  TableGenBreakInsideDAGArg: BreakAll\n  TableGenBreakingDAGArgOperators: [ins, outs]\n
\n

makes the line break only occurs inside DAGArgs beginning with the\nspecified identifiers ins and outs.\n

\n

  let DAGArgIns = (ins\n      i32:$src1,\n      i32:$src2\n  );\n  let DAGArgOtherID = (other i32:$other1, i32:$other2);\n  let DAGArgBang = (!cast<SomeType>(\"Some\") i32:$src1, i32:$src2)\n

From clang-format 19" + }, + "TypeNames": { + "type": "array", + "items": { + "type": "string" + }, + "x-intellij-html-description": "TypeNames Documentation\n

A vector of non-keyword identifiers that should be interpreted as type\nnames.\n

A *, &, or && between a type name and another non-keyword\nidentifier is annotated as a pointer or reference token instead of a\nbinary operator.\n

From clang-format 17" }, "TypenameMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of macros that should be interpreted as type declarations\ninstead of as function calls.\n

These are expected to be macros of the form:\n

.. code-block:: c++\n

STACK_OF(...)\n

In the .clang-format configuration file, this can be configured like:\n

.. code-block:: yaml\n

TypenameMacros: ['STACK_OF', 'LIST']\n

For example: OpenSSL STACK_OF, BSD LIST_ENTRY.

Documentation\n" + "x-intellij-html-description": "TypenameMacros Documentation\n

A vector of macros that should be interpreted as type declarations\ninstead of as function calls.\n

These are expected to be macros of the form:\n\n

  STACK_OF(...)\n
\n

In the .clang-format configuration file, this can be configured like:\n\n

  TypenameMacros: [STACK_OF, LIST]\n
\n

For example: OpenSSL STACK_OF, BSD LIST_ENTRY.

From clang-format 9" }, "UseCRLF": { "type": "boolean", - "x-intellij-html-description": "

Use ``\\r\\n`` instead of ``\\n`` for line breaks.\nAlso used as fallback if ``DeriveLineEnding`` is true.

Documentation\n" + "x-intellij-html-description": "UseCRLF Documentation\n

This option is **deprecated**. See LF and CRLF of LineEnding.

From clang-format 10" }, "UseTab": { "type": "string", @@ -1800,14 +2211,18 @@ "description": "Use tabs whenever we need to fill whitespace that spans at least from" } }, - "x-intellij-html-description": "

The way to use tab characters in the resulting file.

Documentation\n" + "x-intellij-html-description": "UseTab Documentation\n

The way to use tab characters in the resulting file.

From clang-format 3.7

Invoke completion to see all options" + }, + "VerilogBreakBetweenInstancePorts": { + "type": "boolean", + "x-intellij-html-description": "VerilogBreakBetweenInstancePorts Documentation\n

For Verilog, put each port on its own line in module instantiations.\n\n

   true:\n   ffnand ff1(.q(),\n              .qbar(out1),\n              .clear(in1),\n              .preset(in2));\n\n   false:\n   ffnand ff1(.q(), .qbar(out1), .clear(in1), .preset(in2));\n

From clang-format 17" }, "WhitespaceSensitiveMacros": { "type": "array", "items": { "type": "string" }, - "x-intellij-html-description": "

A vector of macros which are whitespace-sensitive and should not\nbe touched.\n

These are expected to be macros of the form:\n

.. code-block:: c++\n

STRINGIZE(...)\n

In the .clang-format configuration file, this can be configured like:\n

.. code-block:: yaml\n

WhitespaceSensitiveMacros: ['STRINGIZE', 'PP_STRINGIZE']\n

For example: BOOST_PP_STRINGIZE

Documentation\n" + "x-intellij-html-description": "WhitespaceSensitiveMacros Documentation\n

A vector of macros which are whitespace-sensitive and should not\nbe touched.\n

These are expected to be macros of the form:\n\n

  STRINGIZE(...)\n
\n

In the .clang-format configuration file, this can be configured like:\n\n

  WhitespaceSensitiveMacros: [STRINGIZE, PP_STRINGIZE]\n
\n

For example: BOOST_PP_STRINGIZE

From clang-format 11" } } } diff --git a/update-template.txt b/update-template.txt index 3c94370..4021d5b 100644 --- a/update-template.txt +++ b/update-template.txt @@ -1,3 +1,5 @@ +Tips to update the plugin from template (intellij-platform-plugin-template) + LAST_PULL_COMMIT=98cba4ff3176dbc83b800190a74559c594f8d772 git remote add template git@github.com:JetBrains/intellij-platform-plugin-template.git git fetch template @@ -8,4 +10,3 @@ git diff $LAST_PULL_COMMIT template/main > diff.patch # Double check the diff before committing git diff HEAD template/main -