mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-15 02:37:45 +08:00
fmt: Add support for block nesting. (#3105)
Previously the formatter did not include support for blocks inside other blocks. Hence the formatter could not indent some files properly. This fixes it. Fixes #3104 Signed-off-by: Vaibhav <vrongmeal@gmail.com>
This commit is contained in:
@@ -29,6 +29,22 @@ b
|
||||
|
||||
e { f
|
||||
}
|
||||
|
||||
g {
|
||||
h {
|
||||
i
|
||||
}
|
||||
}
|
||||
|
||||
j { k {
|
||||
l
|
||||
}
|
||||
}
|
||||
|
||||
m {
|
||||
n { o
|
||||
}
|
||||
}
|
||||
`)
|
||||
expected := []byte(`
|
||||
a
|
||||
@@ -41,6 +57,24 @@ c {
|
||||
e {
|
||||
f
|
||||
}
|
||||
|
||||
g {
|
||||
h {
|
||||
i
|
||||
}
|
||||
}
|
||||
|
||||
j {
|
||||
k {
|
||||
l
|
||||
}
|
||||
}
|
||||
|
||||
m {
|
||||
n {
|
||||
o
|
||||
}
|
||||
}
|
||||
`)
|
||||
testFormat(t, input, expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user