forked from OSchip/llvm-project
clang-format: [proto] Add required space before absolute references.
llvm-svn: 211488
This commit is contained in:
parent
32ccb03871
commit
9c2820c4e3
|
@ -1406,6 +1406,10 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
|||
const FormatToken &Left,
|
||||
const FormatToken &Right) {
|
||||
if (Style.Language == FormatStyle::LK_Proto) {
|
||||
if (Right.is(tok::period) &&
|
||||
(Left.TokenText == "optional" || Left.TokenText == "required" ||
|
||||
Left.TokenText == "repeated"))
|
||||
return true;
|
||||
if (Right.is(tok::l_paren) &&
|
||||
(Left.TokenText == "returns" || Left.TokenText == "option"))
|
||||
return true;
|
||||
|
|
|
@ -46,6 +46,9 @@ TEST_F(FormatTestProto, FormatsMessages) {
|
|||
verifyFormat("message SomeMessage {\n"
|
||||
" required int32 field1 = 1;\n"
|
||||
"}");
|
||||
verifyFormat("message SomeMessage {\n"
|
||||
" required .absolute.Reference field1 = 1;\n"
|
||||
"}");
|
||||
verifyFormat("message SomeMessage {\n"
|
||||
" required int32 field1 = 1;\n"
|
||||
" optional string field2 = 2 [default = \"2\"]\n"
|
||||
|
|
Loading…
Reference in New Issue