Skip to content

Fix group source code info location#675

Merged
doriable merged 4 commits intomainfrom
fix-group-source-code-info-location
Mar 10, 2026
Merged

Fix group source code info location#675
doriable merged 4 commits intomainfrom
fix-group-source-code-info-location

Conversation

@doriable
Copy link
Member

@doriable doriable commented Mar 9, 2026

This fixes the source code info for group fields,
where the comments for group fields should be attributed
to the synthetic message type rather than the field.

This behaviour has been checked against protoc.

@doriable doriable requested a review from mcy March 9, 2026 20:01
if prefixed := fieldAST.Type.AsPrefixed(); !prefixed.IsZero() {
return prefixed.PrefixToken().ID()
}
return token.ID(fieldAST.Type.ID())
Copy link
Member

Choose a reason for hiding this comment

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

This seems wrong...?

Copy link
Member Author

Choose a reason for hiding this comment

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

^^" How so? This is just a small refactor for the previous logic using the field AST's type token or its prefix token as starts for the field definition...? Unless you're saying the previous logic is also wrong?

Copy link
Member

@mcy mcy Mar 9, 2026

Choose a reason for hiding this comment

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

oh uh. the cast seems redudant...? This does not seem obviously correct is what I mean. Wouldn't it be more robust to pull the span and then use stream.Around?

Copy link
Member Author

Choose a reason for hiding this comment

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

the cast seems redudant...?

So it doesn't seem to want to compile without it... and I think it's because it's the ID for TypeAny... o_o That being said, it's kind of moot because...

Wouldn't it be more robust to pull the span and then use stream.Around?

Honestly, yeah, this is better, I refactored all of the logic here to just do that and ensured that the tests are still passing/correct. So this helper is no longer needed.

@doriable doriable merged commit ffc7be1 into main Mar 10, 2026
6 checks passed
@doriable doriable deleted the fix-group-source-code-info-location branch March 10, 2026 13:23
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.

2 participants