Add formatting of type parameters in class and function definitions#6161
Merged
Add formatting of type parameters in class and function definitions#6161
Conversation
Contributor
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinuxWindows |
Member
|
Ooooh yes |
72 tasks
MichaReiser
approved these changes
Jul 31, 2023
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Niiiice! This is looking good. I have two test cases that I recommend you adding and I think we can move some more logic into the clause formatting helper.
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/function.py
Outdated
Show resolved
Hide resolved
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/function.py
Outdated
Show resolved
Hide resolved
crates/ruff_python_formatter/src/type_param/type_param_param_spec.rs
Outdated
Show resolved
Hide resolved
crates/ruff_python_formatter/src/type_param/type_param_type_var_tuple.rs
Outdated
Show resolved
Hide resolved
konstin
approved these changes
Jul 31, 2023
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/class_definition.py
Show resolved
Hide resolved
zanieb
commented
Jul 31, 2023
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/function.py
Outdated
Show resolved
Hide resolved
655d055 to
4ac79ac
Compare
zanieb
commented
Aug 2, 2023
| } | ||
| } | ||
|
|
||
| /// Attach an enclosed end-of-line comment to a set of [`TypeParams`]. |
4ac79ac to
3660033
Compare
zanieb
added a commit
that referenced
this pull request
Aug 2, 2023
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.
Part of #5062
Closes #5931
Implements formatting of a sequence of type parameters in a dedicated struct for reuse by classes, functions, and type aliases (preparing for #5929). Adds formatting of type parameters in class and function definitions — previously, they were just elided.