If `false`, spaces will be removed before case colon.
true: false switch (x) { vs. switch (x) { case 1 : break; case 1: break; } }
Paths
| Differential D93240
[clang-format] Add SpaceBeforeCaseColon option ClosedPublic Authored by HazardyKnusperkeks on Dec 14 2020, 1:21 PM.
Details Summary If `false`, spaces will be removed before case colon. true: false switch (x) { vs. switch (x) { case 1 : break; case 1: break; } }
Diff Detail
Event TimelineHazardyKnusperkeks created this revision. Comment Actions I generally don't have the same aversion to new options than others have, but can you point out a style guide that might want this option. (that is kind of the process) Comment Actions
Mostly: My own style :) But I was really surprised that this is not in already, when nearly all other colons can be given a space and actually are in the default. But I can show something I got from the web:
Comment Actions Nit: Please just separate your test from old test, apart from that I think its fine I noticed support for this on uncrustify, (but couldn't find many github references who didn't set it to remove!) I think adding this is fine
This revision is now accepted and ready to land.Dec 19 2020, 6:03 AM Closed by commit rG47877c9079c2: [clang-format] Add SpaceBeforeCaseColon option (authored by HazardyKnusperkeks). · Explain WhyDec 23 2020, 1:08 PM This revision was automatically updated to reflect the committed changes. Comment Actions
why would it? Comment Actions
Of course, because it's only for case.
Revision Contents
Diff 312877 clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
|
maybe add a default example with {}
try not to change existing tests just add your own new ones