<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54848>54848</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
When formatting protobuf, clang-format inserts a space after "keyword" inside field options
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hexchain
</td>
</tr>
</table>
<pre>
Protobuf keywords may appear in a field option, e.g. https://github.com/envoyproxy/protoc-gen-validate/blob/main/README.md#repeated. When formatting a file with such field option, `clang-format` insists on inserting a space after the "keyword".
Example file:
```proto
syntax = "proto3";
package proto.test;
message A {
int32 a = 1;
}
message B {
repeated A a = 1 [(annotation).int32.repeated.required.optional.oneof.test = true];
}
```
Output of `clang-format --style=Google`:
```proto
syntax = "proto3";
package proto.test;
message A {
int32 a = 1;
}
message B {
repeated A a = 1
[(annotation).int32.repeated .required .optional .oneof.test = true];
}
```
Expected output:
No space should be inserted after "keywords" in a field option.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVE1zmzAQ_TXiorEGC1PjAwenOD31Y3rpWcDy0QiJSiIx_74rgZ3EybSHnurRwIr1vn37pN1S13P-zWiny6mhDzA_aVNbOoiZinEEYWivqKBND7KmenS9VoR_pMBaRjvnRkuSI-H3uNredVPJKj3gBtSjnkejzzNuRg9fbVpQm0ch-1o4wK-l1CW-BtEj4v3307H4fGJDTXhiABM7qBn90YGijTaDcK5XbSAigT5hKmqnqnvDi3yIKylUu1mCcIv8bW-dpVp5E8wKZEdRARWNA0NdB5RwvlaPFiNxQeLj8jydxTBiVp_aV_vChfjLCiUu3-ysnDhTkhQeMzgSNEhyt_gx74NogQYPc2Dd1bU8B7DW_-FIyX51UKTuEo60Pez2OWBfvBd59zLyoibireGUpHeEZ0Ip7cSi3IGFBOwqvYFfU2_QWLQVkmkFugl8A4ozE5C0eIfKRZOXzL5Obpwc1c3tCdHNxrrZC1t80rpFAwOT_1rei8f__q40vUpNr1rTfxP7dB6h8tA6qH5zZ7_o9e7bTk_YPCWsfYEBSzs8t4JF8-0AYFGdJ_UhOYjI9U5Cftum4zpPfEe-Ouwlkb1pv1etF_q1hlcJbTQZmf9h3Ej5eHltMPlPLB-3vbUTYAn36S7bZVGX8-RQ1knWAK_rZL_bN3FWCtFwzvfxFuptJEUJ0ubh1LiCJxog_PVKi6jPecx5vNtutzGumCFCVqa7ND00TcqzmOxiwHEmmefBtGkjkwdK5dRadEo_h56dwtq-VQAhHeKLyXXa5B2cqw6HYhRy54H7b5uwvJ4">