Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Format
PatternMatchStar
#6653Format
PatternMatchStar
#6653Changes from all commits
84ed8e8
4a54663
38ab405
4554581
4d20b60
1ec8d04
940609b
a554733
2da6dea
c035020
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is formatted first to:
then formatted to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at
you get
so i think the best solution is to manually reassign the comment from dangling to trailing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@konstin Thanks for the comment. How can we access this leading-dangiling-trailing mapping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harupy - I typically run something like
cargo run foo.py --emit=stdout --print-comments
fromruff/crates/ruff_python_formatter
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry. You're asking how to modify these assignments. Any such modifications need to be done in
placement.rs
-- those are essentially custom rules that let us change the association of comments. See, e.g.,handle_trailing_expression_starred_star_end_of_line_comment
which is somewhat similar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to add a case in
handle_enclosed_comment
for when the enclosing node isPatternMatchStar
. The general logic to fix comment placement is inplacement.rs
/place_comment
.