mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:55:08 +00:00
Use reserved width to include line suffix measurement (#6901)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
edfd888bd6
commit
a3f4d7745a
16 changed files with 504 additions and 80 deletions
|
@ -14,6 +14,6 @@ def function(a:int=42):
|
|||
a
|
||||
b
|
||||
"""
|
||||
# There's a NBSP + 3 spaces before
|
||||
# There's a NBSP + 3 spaces before
|
||||
# And 4 spaces on the next line
|
||||
pass
|
||||
|
|
|
@ -66,3 +66,6 @@ g2 = ( # a
|
|||
h1 = ((((1, 2))))
|
||||
h2 = ((((1, "qweiurpoiqwurepqiurpqirpuqoiwrupqoirupqoirupqoiurpqiorupwqiourpqurpqurpqurpqurpqurpqurüqurqpuriq"))))
|
||||
h3 = 1, "qweiurpoiqwurepqiurpqirpuqoiwrupqoirupqoirupqoiurpqiorupwqiourpqurpqurpqurpqurpqurpqurüqurqpuriq"
|
||||
|
||||
i1 = ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",) # This should break
|
||||
|
||||
|
|
6
crates/ruff_python_formatter/resources/test/fixtures/ruff/trailing_comments.py
vendored
Normal file
6
crates/ruff_python_formatter/resources/test/fixtures/ruff/trailing_comments.py
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
# As of adding this fixture Black adds a space before the non-breaking space if part of a type pragma.
|
||||
# https://github.com/psf/black/blob/b4dca26c7d93f930bbd5a7b552807370b60d4298/src/black/comments.py#L122-L129
|
||||
i2 = "" # type: Add space before leading NBSP followed by spaces
|
||||
i3 = "" #type: A space is added
|
||||
i4 = "" # type: Add space before leading NBSP followed by a space
|
||||
i5 = "" # type: Add space before leading NBSP
|
Loading…
Add table
Add a link
Reference in a new issue