protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Proto not put comments in generated files

Open nejcgalof opened this issue 7 years ago • 3 comments

We have problem, when we define proto like this and generate C++ code:

// comment 1:
enum Type {
  INVALID = 0;
  UNSET = 1;
  TYPE_ONE = 2;
}
/*
 comment2
*/
message Test{
    uint32 some1 = 1; // com1
    uint32 some2 = 2; // com2
    uint32 some3 = 3; // com3
}

Code works good in C++ and C# (we tested only this two languages), but in C++ we don't see any of this comments (like <summary> in C#). We try same proto in C#, and comments add normal. How we can get same functionality in C++. So how can we add comments in front of classes or enums? We use proto3 syntax with protobuf 3.6.1.

Thank you for help.

nejcgalof avatar Feb 05 '19 15:02 nejcgalof

I think for C++ we have always done it this way and I'm not sure if there is any good reason for it. I am a bit hesitant to add in more comments, though, because I don't know what the effect on builds will be. Larger header files could result in slower compiles and less ability to cache results.

acozzette avatar Feb 12 '19 23:02 acozzette

Reason why this will be good is to get comments (informations) on objects. Yes, this effects compile time, but helps users who reuse generated objects. They can get more info on what some objects do. Maybe a good solution is a flag, where you choose if you want add comments or not.

nejcgalof avatar Feb 15 '19 10:02 nejcgalof

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 05 '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 20 '24 10:05 github-actions[bot]