Merged
Conversation
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Closed
MichaReiser
commented
Jun 22, 2023
| libcst = { git = "https://github.com/charliermarsh/LibCST", rev = "80e4c1399f95e5beb532fdd1e209ad2dbb470438" } | ||
| # v0.0.3 | ||
| ruff_text_size = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "08ebbe40d7776cac6e3ba66277d435056f2b8dca" } | ||
| ruff_text_size = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "f60e204b73b95bdb6ce87ccd0de34081b4a17c11" } |
MichaReiser
commented
Jun 22, 2023
MichaReiser
commented
Jun 22, 2023
| .. | ||
| } = self.class_definition; | ||
|
|
||
| let separator = format_with(|f| write!(f, [text(","), soft_line_break_or_space()])); |
Member
Author
There was a problem hiding this comment.
We should probably extract a helper at some point that joins a list with , and soft_line_break_or_space and preserves any trailing magic comma.
b8cc710 to
5acb7be
Compare
konstin
approved these changes
Jun 22, 2023
Comment on lines
+89
to
+95
| // Manually handle parentheses here because the expression is parenthesized incorrectly assumes that the | ||
| // parentheses from the inheritance clause belong to the expression. |
Member
Author
There was a problem hiding this comment.
I reworded the comment and added an example.
| class_definition: &'a StmtClassDef, | ||
| } | ||
|
|
||
| impl Format<PyFormatContext<'_>> for FormatInheritanceClause<'_> { |
Member
There was a problem hiding this comment.
Is this effectively formatting a function call?
Member
Author
There was a problem hiding this comment.
It's similar but it doesn't need to support any of the complexity like chaining.
5acb7be to
4967e08
Compare
4967e08 to
132b654
Compare
Contributor
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinuxWindows |
132b654 to
5a7f9b1
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
This PR adds basic formatting for
classdefinitions.Test Plan
Ran the stability check to verify that the class definition formatting does not introduce any new instabilities.
Added new snapshot tests.