File tree 2 files changed +17
-1
lines changed
test/SourceKit/CodeFormat
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -456,7 +456,9 @@ class FormatContext {
456
456
auto AtCursorExpr = Cursor->getAsExpr ();
457
457
if (AtExprEnd && AtCursorExpr && (isa<ParenExpr>(AtCursorExpr) ||
458
458
isa<TupleExpr>(AtCursorExpr))) {
459
- if (isa<CallExpr>(AtExprEnd)) {
459
+ if (isa<CallExpr>(AtExprEnd) ||
460
+ isa<ArrayExpr>(AtExprEnd) ||
461
+ isa<DictionaryExpr>(AtExprEnd)) {
460
462
if (exprEndAtLine (AtExprEnd, Line) &&
461
463
exprEndAtLine (AtCursorExpr, Line)) {
462
464
return false ;
Original file line number Diff line number Diff line change @@ -15,12 +15,26 @@ struct Foo {
15
15
" b " : 2
16
16
]
17
17
}
18
+ func foo( ) {
19
+ print ( [
20
+ " Hello, World! " ,
21
+ " Hello, World! " ,
22
+ ] )
23
+ print ( [
24
+ " Hello, World! " : 1 ,
25
+ " Hello, World! " : 2 ,
26
+ ] )
27
+ }
18
28
}
19
29
20
30
// RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >%t.response
21
31
// RUN: %sourcekitd-test -req=format -line=11 -length=1 %s >>%t.response
22
32
// RUN: %sourcekitd-test -req=format -line=16 -length=1 %s >>%t.response
33
+ // RUN: %sourcekitd-test -req=format -line=22 -length=1 %s >>%t.response
34
+ // RUN: %sourcekitd-test -req=format -line=26 -length=1 %s >>%t.response
23
35
// RUN: %FileCheck --strict-whitespace %s <%t.response
24
36
// CHECK: key.sourcetext: " ]"
25
37
// CHECK: key.sourcetext: " ]"
26
38
// CHECK: key.sourcetext: " ]"
39
+ // CHECK: key.sourcetext: " ])"
40
+ // CHECK: key.sourcetext: " ])"
You can’t perform that action at this time.
0 commit comments