protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Accept trailing comma on field extension list.

Open Icantjuddle opened this issue 2 years ago • 3 comments

Right now trailing commas on field extensions are considered to be a missing identifiers.

Re-produce as:

 protoc \
  <(echo 'syntax = "proto3";\npackage test;\nimport "google/protobuf/descriptor.proto";\nextend google.protobuf.FieldOptions {\n  int32 a = 50000;\n  int32 b = 50001;\n}\nmessage Test {\n  int32 test = 1 [(a) = 1, (b) = 2,];\n}') \ 
  --cpp_out $(mktemp -d) \
  --proto_path /proc/self/fd/

(tested on 3.6.1)

Removing the comma at the end of (b) = 2, allows it to compile.

What language does this apply to?

Proto3 (presumably the same in proto2)

Describe the problem you are trying to solve.

I'd like to be able to supply trailing commas.

Describe the solution you'd like

Trailing commas are allowed.

Icantjuddle avatar Oct 25 '23 00:10 Icantjuddle

What is the use case for this? Is it for easy copy paste when you have one line per option? eg.

syntax = "proto3";
package test;
import "google/protobuf/descriptor.proto";
extend google.protobuf.FieldOptions {
  int32 a = 50000;
  int32 b = 50001;
}

message Test {
  int32 test = 1 [
      (a) = 1,
      (b) = 2,
  ];
}

haberman avatar Jan 30 '24 22:01 haberman

What is the use case for this? Is it for easy copy paste when you have one line per option?

Yes, easy re-ordering of lines would be nice, also seems more consistent.

Icantjuddle avatar Jan 31 '24 04:01 Icantjuddle

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar May 08 '24 10:05 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar May 22 '24 10:05 github-actions[bot]