Issue 243063
Summary [clang-format] Support half-indentation for switch (`case`/`default`) labels
Labels clang-format
Assignees
Reporter damster101
    `clang-format` currently offers only a boolean `IndentCaseLabels`:
- `false`: indents `case`/`default` labels by +0 relative to `switch`.
- `true`: indents `case`/`default` labels by full `IndentWidth`, pushing statements to 2*`IndentWidth`

Half-indent style is already supported for both access modifiers and goto labels. And I think such a style would make sense for switch label indentation as well, here with statements getting indented by `IndentWidth`, while switch labels get half-indented.

My proposal is to either
- add a `CaseLabelOffset` option analogous to `AccessModifierOffset` which shifts switch label indentation relative to current behavior
- rework `IndentCaseLabels` so it mirrors `GotoCaseLabels`, with `true` and `false` becoming aliases, and `HalfIndent` being added

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to