Skip to content
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

Compiler: generate doc comments #860

Merged
merged 10 commits into from
Jul 12, 2023
Merged

Compiler: generate doc comments #860

merged 10 commits into from
Jul 12, 2023

Conversation

kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented Jul 10, 2023

Fixes #161

Copy link
Member

@osa1 osa1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @kevmoo. Added a few inline comments and suggestions.

protoc_plugin/lib/src/shared.dart Outdated Show resolved Hide resolved
protoc_plugin/lib/src/shared.dart Outdated Show resolved Hide resolved
return null;
}

final _leadingSpaces = RegExp('^ +');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about other whitespace characters? https://protobuf.dev/reference/protobuf/textformat-spec/#whitespace

I really dislike regexes for simple things like this, but maybe this is the easiest in Dart..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space seems like the only reasonable initial character here. Maybe tab?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah tabs should be common. I don't even know what vertical tab and form feed are and I suspect they're not used in practice. Carriage return should be handled by the line splitter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay to handle these case-by-case. In all of the bits I looked through they ALWAYS seem to have one leading space – that's it!

protoc_plugin/lib/src/shared.dart Outdated Show resolved Hide resolved
protoc_plugin/pubspec.yaml Outdated Show resolved Hide resolved
protoc_plugin/CHANGELOG.md Outdated Show resolved Hide resolved
protoc_plugin/CHANGELOG.md Outdated Show resolved Hide resolved
kevmoo and others added 6 commits July 11, 2023 10:36
Co-authored-by: Ömer Sinan Ağacan <omersa@google.com>
Co-authored-by: Ömer Sinan Ağacan <omersa@google.com>
Co-authored-by: Ömer Sinan Ağacan <omersa@google.com>
@kevmoo kevmoo changed the title Compiler: initial (experimental) support for generating code comments Compiler: generate doc comments Jul 12, 2023
@kevmoo kevmoo merged commit d9e8a31 into master Jul 12, 2023
18 checks passed
@kevmoo kevmoo deleted the i161_comments branch July 12, 2023 22:00
@MattyBoy4444
Copy link

This doesn't grab comments at the end of the line.

EX:

message Animal {
string name = 1; //This is the name of the animal
}

@kevmoo
Copy link
Collaborator Author

kevmoo commented Jul 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments from .proto files should move over to dart
3 participants