This commit is contained in:
2025-04-17 00:10:46 +08:00
parent 52bfd05b80
commit 26d183f4c9
8 changed files with 94 additions and 9 deletions

View File

@@ -13,7 +13,7 @@ type commentGenerator struct {
descriptor protoreflect.Descriptor
}
func (c commentGenerator) generateLeading(f *codegen.File, indent int) {
func (c commentGenerator) generateLeading(f *codegen.File, indent int) string {
loc := c.descriptor.ParentFile().SourceLocations().ByDescriptor(c.descriptor)
var comments string
if loc.TrailingComments != "" {
@@ -34,6 +34,8 @@ func (c commentGenerator) generateLeading(f *codegen.File, indent int) {
f.P(t(indent), "/** "+behaviorComment+" */")
}
}
return strings.TrimSpace(comments)
}
func fieldBehaviorComment(field protoreflect.FieldDescriptor) string {