Index: docs/ClangFormatStyleOptions.rst =================================================================== --- docs/ClangFormatStyleOptions.rst +++ docs/ClangFormatStyleOptions.rst @@ -777,19 +777,31 @@ .. code-block:: c++ - try { - foo(); + try + { + foo(); } - catch () { + catch () + { } - void foo() { bar(); } - class foo { + void foo() + { + bar(); + } + class foo + { }; - if (foo()) { + if (foo()) + { } - else { + else + { } - enum X : int { A, B }; + enum X : int + { + A, + B + }; * ``BS_GNU`` (in configuration: ``GNU``) Always break before braces and add an extra level of indentation to @@ -865,7 +877,7 @@ ? firstValue : SecondValueVeryVeryVeryVeryLong; - true: + false: veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ? firstValue : SecondValueVeryVeryVeryVeryLong; @@ -884,6 +896,17 @@ **BreakStringLiterals** (``bool``) Allow breaking string literals when formatting. + + .. code-block:: c++ + + true: + const char* x = "veryVeryVeryVeryVeryVe" + "ryVeryVeryVeryVeryVery" + "VeryLongString"; + + false: + const char* x = + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; **ColumnLimit** (``unsigned``) The column limit. @@ -1040,6 +1063,32 @@ When ``false``, use the same indentation level as for the switch statement. Switch statement body is always indented one level more than case labels. + + .. code-block:: c++ + + true: + switch (type) { + case FirstCase: + FirstFunction(); + break; + + case SecondCase: { + SecondFunction(); + } + break; + } + + false: + switch (type) { + case FirstCase: + FirstFunction(); + break; + + case SecondCase: { + SecondFunction(); + } + break; + } **IndentWidth** (``unsigned``) The number of columns to use for indentation. @@ -1106,6 +1155,19 @@ **KeepEmptyLinesAtTheStartOfBlocks** (``bool``) If true, empty lines at the start of blocks are kept. + + .. code-block:: c++ + + true: + void foo() { + + bar(); + } + + false: + void foo() { + bar(); + } **Language** (``LanguageKind``) Language, this format style is targeted at.