Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -1570,8 +1570,10 @@ const FormatToken *NextNonComment = Current->getNextNonComment(); if (Current->is(TT_ConditionalExpr)) return prec::Conditional; - if (NextNonComment && NextNonComment->is(tok::colon) && - NextNonComment->is(TT_DictLiteral)) + if (NextNonComment && Current->is(TT_SelectorName) && + (NextNonComment->is(TT_DictLiteral) || + (Style.Language == FormatStyle::LK_Proto && + NextNonComment->is(tok::less)))) return prec::Assignment; if (Current->is(TT_JsComputedPropertyName)) return prec::Assignment; Index: unittests/Format/FormatTestProto.cpp =================================================================== --- unittests/Format/FormatTestProto.cpp +++ unittests/Format/FormatTestProto.cpp @@ -201,6 +201,12 @@ " field_c: \"OK\"\n" " msg_field{field_d: 123}\n" "};"); + verifyFormat("option (MyProto.options) = {\n" + " field_a: OK\n" + " field_b{field_c: OK}\n" + " field_d: OKOKOK\n" + " field_e: OK\n" + "}"); // Support syntax with <> instead of {}. verifyFormat("option (MyProto.options) = {\n" @@ -208,6 +214,13 @@ " msg_field: \n" "};"); + verifyFormat("option (MyProto.options) = {\n" + " field_a: OK\n" + " field_b\n" + " field_d: OKOKOK\n" + " field_e: OK\n" + "}"); + verifyFormat("option (MyProto.options) = {\n" " msg_field: <>\n" " field_c: \"OK\",\n"