Skip to content

Commit c0b5cb9

Browse files
author
Nathan Hawes
authored
Merge pull request swiftlang#31098 from nathawes/indentation-fixes
[SourceKit/CodeFormat] Indentation fixes for multi-line string, UnresolvedSpecializeExpr, and trailing target handling.
2 parents d929395 + e01c1a1 commit c0b5cb9

25 files changed

+320
-104
lines changed

lib/IDE/Formatting.cpp

Lines changed: 202 additions & 102 deletions
Large diffs are not rendered by default.

test/SourceKit/CodeFormat/indent-trailing/trailing-closure-in.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ func foo() {
55
) in
66

77
// RUN: %sourcekitd-test -req=format -line=6 -length=1 %s | %FileCheck --strict-whitespace %s
8-
// CHECK: key.sourcetext: " "
8+
// CHECK: key.sourcetext: " "
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enum Foo {
2+
case a,
3+
4+
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s | %FileCheck --strict-whitespace %s
5+
// CHECK: key.sourcetext: " "
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enum Foo {
2+
case
3+
4+
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s | %FileCheck --strict-whitespace %s
5+
// CHECK: key.sourcetext: " "
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enum Foo {
2+
case a
3+
4+
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s | %FileCheck --strict-whitespace %s
5+
// CHECK: key.sourcetext: " "
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
struct Foo<T: Equatable,
2+
3+
// RUN: %sourcekitd-test -req=format -line=2 -length=1 %s | %FileCheck --strict-whitespace %s
4+
// CHECK: key.sourcetext: " "
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
struct Foo<T: Equatable
2+
3+
// RUN: %sourcekitd-test -req=format -line=2 -length=1 %s | %FileCheck --strict-whitespace %s
4+
// CHECK: key.sourcetext: ""

test/SourceKit/CodeFormat/indent-trailing/trailing-guard-condition.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ func foo(x: Bool) {
22
guard let number = patterns.index(where: {
33

44
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s | %FileCheck --strict-whitespace %s
5-
// CHECK: key.sourcetext: " "
5+
// CHECK: key.sourcetext: " "
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
func foo(x: Bool) {
2+
guard let number = Optional(23),
3+
4+
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s | %FileCheck --strict-whitespace %s
5+
// CHECK: key.sourcetext: " "
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
func foo(x: Bool) {
2+
guard
3+
4+
// RUN: %sourcekitd-test -req=format -line=3 -length=1 %s | %FileCheck --strict-whitespace %s
5+
// CHECK: key.sourcetext: " "

0 commit comments

Comments
 (0)