File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
test/SourceKit/CodeFormat Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -489,7 +489,8 @@ class FormatContext {
489
489
// }.map { <--- No indentation here.
490
490
// ...
491
491
// }
492
- if (AtExprEnd && AtCursorExpr && isa<CallExpr>(AtExprEnd)) {
492
+ if (AtExprEnd && AtCursorExpr &&
493
+ (isa<CallExpr>(AtExprEnd) || isa<SubscriptExpr>(AtExprEnd))) {
493
494
if (auto *UDE = dyn_cast<UnresolvedDotExpr>(AtCursorExpr)) {
494
495
if (auto *Base = UDE->getBase ()) {
495
496
if (exprEndAtLine (Base, Line))
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ func foo9(input: [Int]){
62
62
}
63
63
}
64
64
65
+ func foo10( ) {
66
+ Something ( ) [
67
+ ] . whatever
68
+ }
69
+
65
70
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >%t.response
66
71
// RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
67
72
// RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >>%t.response
@@ -89,6 +94,9 @@ func foo9(input: [Int]){
89
94
// RUN: %sourcekitd-test -req=format -line=62 -length=1 %s >>%t.response
90
95
// RUN: %sourcekitd-test -req=format -line=63 -length=1 %s >>%t.response
91
96
97
+ // RUN: %sourcekitd-test -req=format -line=66 -length=1 %s >>%t.response
98
+ // RUN: %sourcekitd-test -req=format -line=67 -length=1 %s >>%t.response
99
+
92
100
// RUN: %FileCheck --strict-whitespace %s <%t.response
93
101
94
102
// CHECK: key.sourcetext: " var abc = 1"
@@ -125,3 +133,6 @@ func foo9(input: [Int]){
125
133
// CHECK: key.sourcetext: " return ele + 1"
126
134
// CHECK: key.sourcetext: " }"
127
135
// CHECK: key.sourcetext: "}"
136
+
137
+ // CHECK: key.sourcetext: " Something() ["
138
+ // CHECK: key.sourcetext: " ].whatever"
You can’t perform that action at this time.
0 commit comments