mirror of
https://github.com/apple/pkl.git
synced 2026-03-31 06:03:11 +02:00
Don't force multiline interpolation into a single line (#1280)
Also, fixes an issue where forced single-line formatting would break for if/else and let expressions --------- Co-authored-by: Islon Scherer <islonscherer@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ prop3 =
|
||||
\(new {
|
||||
// some comment
|
||||
foo = 1
|
||||
|
||||
|
||||
// some comment
|
||||
bar = 2
|
||||
})
|
||||
@@ -49,3 +49,28 @@ prop7 = "\(
|
||||
)"
|
||||
|
||||
prop8 = "\(new { foo = 1 bar = 2 baz = 3 })"
|
||||
|
||||
prop9 = "\(if (true) 1 else 2)"
|
||||
|
||||
prop10 = "\(
|
||||
if (true) 1
|
||||
else 2
|
||||
)"
|
||||
|
||||
prop11 = "\(
|
||||
new {
|
||||
1;
|
||||
2;
|
||||
3;
|
||||
}
|
||||
)"
|
||||
|
||||
// single line expressions are not broken up
|
||||
prop12 = "Some \(if (true) 1 else 2) reeeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaallly long string with interpolation"
|
||||
|
||||
// multi-line expressions are preserved
|
||||
prop13 = "Some \(
|
||||
if (true)
|
||||
1
|
||||
else 2
|
||||
) reeeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaallly long string with interpolation"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
foo =
|
||||
"""
|
||||
asd \(new { bar = 1 }) asd
|
||||
asd \(new {
|
||||
bar = 1
|
||||
}) asd
|
||||
"""
|
||||
|
||||
bar =
|
||||
|
||||
@@ -50,3 +50,29 @@ prop7 =
|
||||
)"
|
||||
|
||||
prop8 = "\(new { foo = 1; bar = 2; baz = 3 })"
|
||||
|
||||
prop9 = "\(if (true) 1 else 2)"
|
||||
|
||||
prop10 =
|
||||
"\(if (true)
|
||||
1
|
||||
else
|
||||
2)"
|
||||
|
||||
prop11 =
|
||||
"\(new {
|
||||
1
|
||||
2
|
||||
3
|
||||
})"
|
||||
|
||||
// single line expressions are not broken up
|
||||
prop12 =
|
||||
"Some \(if (true) 1 else 2) reeeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaallly long string with interpolation"
|
||||
|
||||
// multi-line expressions are preserved
|
||||
prop13 =
|
||||
"Some \(if (true)
|
||||
1
|
||||
else
|
||||
2) reeeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaallly long string with interpolation"
|
||||
|
||||
Reference in New Issue
Block a user