mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IDE: Fix formatting of closing square brackets
Previously closing square brackets would be caught in the logic for elements in collections, indenting them to the same level. Now they are indented with the normal non-sibling logic, which indents them correctly.
This commit is contained in:
26
test/SourceKit/CodeFormat/indent-closing-array.swift
Normal file
26
test/SourceKit/CodeFormat/indent-closing-array.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
struct Foo {
|
||||
let bar = [
|
||||
1,
|
||||
2,
|
||||
]
|
||||
|
||||
func baz() {
|
||||
let qux = [
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
]
|
||||
|
||||
let quxx = [
|
||||
"a": 1,
|
||||
"b": 2
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >%t.response
|
||||
// RUN: %sourcekitd-test -req=format -line=11 -length=1 %s >>%t.response
|
||||
// RUN: %sourcekitd-test -req=format -line=16 -length=1 %s >>%t.response
|
||||
// RUN: %FileCheck --strict-whitespace %s <%t.response
|
||||
// CHECK: key.sourcetext: " ]"
|
||||
// CHECK: key.sourcetext: " ]"
|
||||
// CHECK: key.sourcetext: " ]"
|
||||
Reference in New Issue
Block a user