mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-21 20:15:11 +00:00
Indent statements in suppressed ranges (#6507)
This commit is contained in:
parent
e1e213decf
commit
232b44a8ca
18 changed files with 852 additions and 59 deletions
|
@ -255,31 +255,16 @@ if True:
|
|||
#[ignore]
|
||||
#[test]
|
||||
fn quick_test() {
|
||||
let src = r#"
|
||||
with (
|
||||
[
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"bbbbbbbbbb",
|
||||
"cccccccccccccccccccccccccccccccccccccccccc",
|
||||
dddddddddddddddddddddddddddddddd,
|
||||
] as example1,
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
+ cccccccccccccccccccccccccccc
|
||||
+ ddddddddddddddddd as example2,
|
||||
CtxManager2() as example2,
|
||||
CtxManager2() as example2,
|
||||
CtxManager2() as example2,
|
||||
):
|
||||
...
|
||||
let src = r#"def test():
|
||||
# fmt: off
|
||||
|
||||
with [
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"bbbbbbbbbb",
|
||||
"cccccccccccccccccccccccccccccccccccccccccc",
|
||||
dddddddddddddddddddddddddddddddd,
|
||||
] as example1, aaaaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccccccc + ddddddddddddddddd as example2, CtxManager222222222222222() as example2:
|
||||
...
|
||||
a + b
|
||||
|
||||
|
||||
|
||||
# suppressed comments
|
||||
|
||||
a + b # formatted
|
||||
|
||||
"#;
|
||||
// Tokenize once
|
||||
|
@ -304,9 +289,9 @@ with [
|
|||
// Use `dbg_write!(f, []) instead of `write!(f, [])` in your formatting code to print some IR
|
||||
// inside of a `Format` implementation
|
||||
// use ruff_formatter::FormatContext;
|
||||
// dbg!(formatted
|
||||
// formatted
|
||||
// .document()
|
||||
// .display(formatted.context().source_code()));
|
||||
// .display(formatted.context().source_code());
|
||||
//
|
||||
// dbg!(formatted
|
||||
// .context()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue