Preserve trailing semicolons when using fmt: off (#8275)
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/trailing_semicolon.py
|
||||
---
|
||||
## Input
|
||||
```py
|
||||
def f():
|
||||
# fmt: off
|
||||
a = 10
|
||||
|
||||
if True:
|
||||
with_semicolon = 10 \
|
||||
;
|
||||
|
||||
formatted = true;
|
||||
|
||||
|
||||
def f():
|
||||
# fmt: off
|
||||
|
||||
if True:
|
||||
with_semicolon = 20 \
|
||||
; # comment
|
||||
|
||||
|
||||
# fmt: off
|
||||
statement = 0 \
|
||||
;
|
||||
# fmt: on
|
||||
a = 10
|
||||
|
||||
# fmt: off
|
||||
last_statement_with_semi ;
|
||||
```
|
||||
|
||||
## Output
|
||||
```py
|
||||
def f():
|
||||
# fmt: off
|
||||
a = 10
|
||||
|
||||
if True:
|
||||
with_semicolon = 10 \
|
||||
;
|
||||
|
||||
|
||||
formatted = true
|
||||
|
||||
|
||||
def f():
|
||||
# fmt: off
|
||||
|
||||
if True:
|
||||
with_semicolon = 20 \
|
||||
; # comment
|
||||
|
||||
|
||||
# fmt: off
|
||||
statement = 0 \
|
||||
;
|
||||
# fmt: on
|
||||
a = 10
|
||||
|
||||
# fmt: off
|
||||
last_statement_with_semi ;
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user