-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Track formatting all comments #6178
Conversation
PR Check ResultsBenchmarkLinux
Windows
|
@@ -180,6 +180,17 @@ impl Format<PyFormatContext<'_>> for NotYetImplemented { | |||
})?; | |||
|
|||
f.write_element(FormatElement::Tag(Tag::EndVerbatim))?; | |||
|
|||
let comments = f.context().comments().clone(); |
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 could implement your own PreorderVisitor
that marks the comments of all children as formatted. We probably need something similar for fmt: skip
anyway.
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.
i'll wait until we have match statement formatting instead
d7bfa62
to
a132a7c
Compare
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
a132a7c
to
2f771c2
Compare
@@ -24,7 +24,17 @@ impl FormatNodeRule<MatchCase> for FormatMatchCase { | |||
[ | |||
text("case"), | |||
space(), | |||
not_yet_implemented_custom_text("NOT_YET_IMPLEMENTED_Pattern"), | |||
format_with(|f: &mut PyFormatter| { |
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 intentionally ugly to make sure we remove we don't forget to remove the comment.mark_formatted
when replacing this with pattern.format()
Can I now approve my own PR 😅 |
¯\_(ツ)_/¯ |
so who'll merge? |
I can take care of merging since we have to coordinate with the downstream PRs. All I need is a thumbs up/down from you. |
👍 |
f6214dc
to
06db26f
Compare
2f771c2
to
20dabc8
Compare
16e1d70
to
7d92f55
Compare
20dabc8
to
290fff6
Compare
7d92f55
to
e69ff5d
Compare
We currently don't format all comments as match statements are not yet implemented. We can work around this for the top level match statement by setting them manually formatted but the mocked-out top level match doesn't call into its children so they would still have unformatted comments
Graphite rebased this pull request as part of a merge. |
290fff6
to
dc6b84c
Compare
@MichaReiser merged this pull request with Graphite. |
We currently don't format all comments as match statements are not yet implemented. We can work around this for the top level match statement by setting them manually formatted but the mocked-out top level match doesn't call into its children so they would still have unformatted comments