ProtoBuf.jl icon indicating copy to clipboard operation
ProtoBuf.jl copied to clipboard

Preserve comments in output _pb.jl files from original .proto

Open NHDaly opened this issue 6 years ago • 0 comments
trafficstars

This commit adds code to generate_file to copy all the comments from the original .proto file into the new generated _pb.jl file by reading the comments fields off of the SourceCodeInfo proto.

The comments mechanism is a bit confusing in the proto descriptors, so I separated out most of the newly added logic into a new file, src/commetns.jl.

The changes in this commit were inspired by following the example of the code here (which is under the MIT license): https://github.com/pseudomuto/protokit/blob/7037620/comments.go


Before merging:

  • [ ] tests: I think we should probably add some tests, and some explanation to the docs/readme.
  • [ ] implementation: I think there are still some unhandled comments types, such as file-level comments and imports-level comments.

NHDaly avatar Jul 07 '19 03:07 NHDaly