-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make comment at beginning of input file available to plugin authors #1385
Comments
@xfxyjwf: Hey Feng, any news on this? You mentioned on the Google group that something like this may already exist in Google's internal version, and that you would check on the status of it? |
@pherl I remember the support for comments at the beginning of a .proto file is already supported. Jisi, could you comment on this? |
Yes, they are already supported. They should probably in the leading_detached_comments of the syntax location. See the test here: https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/parser_unittest.cc#L1850 |
@pherl: Ah, thanks! I was only looking at 2.6.1. Closing this issue now. Do you know if there's a way in 2.5 / 2.6 to get those comments? If not, do you know of a way to get the full on-disk path to an input proto from a compiler plugin, so that I can parse them out myself as a workaround (short of re-implementing all the command line parsing / SourceTree building that the compiler does)? My compiler plugin must support 2.5 and 2.6 as well, so I'm looking for a way to get those comments from there. Feel free to answer this last question on my mail thread. |
For documentation generator plugins such as my own protoc-gen-doc it would be great if the comment (if any) at the very top of an input
.proto
file was made available somehow inFileDescriptor
.A documentation comment at the top of a file is commonly used in documentation tools for providing documentation for the file as a whole, but currently it's only possible to get at the comments surrounding language constructs (e.g. messages, fields, enums et.c.) through
SourceLocation::leading_comments
andSourceLocation::trailing_comments
.The text was updated successfully, but these errors were encountered: