You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pxf: the parser drops a trailing comment on an entry's line, so formatting moves or loses it #193
Found while porting the formatter fix (#188, PR #192). It was measured on main and is not related to directives.
What happens. The Java parser never attaches a comment that ends an entry's line to that entry. b = 1 # tc formats as b = 1. When another entry follows, # tc is written on the line above it, as that entry's leading comment. At the end of a block the comment is gone. protowire-go keeps it as the entry's trailing comment and writes it back in place.
Why it matters.pxf fmt on a Java build changes what a document's comments describe, or deletes them. It is the one difference between Java's and Go's formatter output in PR #192's byte comparison (13 of 14 documents identical, the 14th differs only here). The C# port has the same bug, trendvidia/protowire-csharp#108.
Done when: a comment after an entry on the same line is kept as that entry's trailing comment, both at the end of a block and in the middle of one, and formatting writes it back on the same line, byte-identical to protowire-go's FormatDocument. Each case has a test.
Same mechanism as #200 (comments that no entry follows, protowire-go#279/#282), in the same files, and the two depend on each other: x = 1 # tc just before } needs this fix to stay on its line. Planned as one PR closing both, one commit each.
Activity
bfrancojr commentedon Nov 8, 2026
Same mechanism as #200 (comments that no entry follows, protowire-go#279/#282), in the same files, and the two depend on each other:
x = 1 # tcjust before}needs this fix to stay on its line. Planned as one PR closing both, one commit each.