]> granicus.if.org Git - clang/commit
[clang-format] Discourage breaks in submessage entries, hard rule
authorKrasimir Georgiev <krasimir@google.com>
Tue, 12 Jun 2018 17:26:31 +0000 (17:26 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Tue, 12 Jun 2018 17:26:31 +0000 (17:26 +0000)
commitf91c23afb2691f7b7a3a4a0516fb0bb9626f8eb5
tree7d798cd83feb07767b32c4f1d2e95cbe9b15e387
parentbc6e12cddf13b8c832775cc2add5f7bf914647c3
[clang-format] Discourage breaks in submessage entries, hard rule

Summary:
Currently clang-format allows this for text protos:
```
submessage:
    { key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' }
```
when it is under the column limit and when putting it all on one line exceeds the column limit.

This is not a very intuitive formatting, so I'd prefer having
```
submessage: {
  key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
}
```
instead, even if it takes one line more.

This patch prevents clang-format from inserting a break between `: {` and similar cases.

Reviewers: djasper, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48063

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334517 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestProto.cpp
unittests/Format/FormatTestTextProto.cpp