Skip to content

fix: #6520, move comment above line if it would cross out the type in… #6577

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarcusGrass
Copy link
Contributor

… a function arg.

fixes #6520

A bit unsure about this one.

The problem is that if you have a comment that spans to the end of the line, then pushing the ty_str after it will make that ty_str part of the comment.

It's similar to this #2976 except isolates comments that do not close themselves.

There's some nuance here, since the decision has to be made where to put the comment. Putting it on top is the simplest, putting it last on the line would require making sure that nothing follows the comment.

Lastly, checking the comment style processes the span again, which is why that's only done conditionally if there is some comment there, so it shouldn't hit most cases. The alternative is a bigger refactor where either the comment style is identified before being passed down to identify_comment, or that metadata is propagated up from the caller. Neither of those options seemed nice.

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

Successfully merging this pull request may close these issues.

Formatting a line comment inbetween a function parameter and its type results in the type being commented out
2 participants