File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,13 @@ final class OnTypeFormattingTests: XCTestCase {
54
54
let testClient = try await TestSourceKitLSPClient ( )
55
55
let uri = DocumentURI ( for: . swift)
56
56
57
- let positions = testClient. openDocument (
58
- """
57
+ let source = """
59
58
func foo() {
60
59
1️⃣if let SomeReallyLongVar = 2️⃣ 3️⃣Some.More.Stuff(), let a = 4️⃣ 5️⃣myfunc() 6️⃣{
61
60
}
62
61
}
63
- """ ,
64
- uri: uri
65
- )
62
+ """
63
+ let positions = testClient. openDocument ( source, uri: uri)
66
64
67
65
let response = try await testClient. send (
68
66
DocumentOnTypeFormattingRequest (
@@ -74,13 +72,18 @@ final class OnTypeFormattingTests: XCTestCase {
74
72
)
75
73
76
74
let edits = try XCTUnwrap ( response)
75
+ let ( _, unmarkedSource) = extractMarkers ( source)
76
+ let formattedSource = unmarkedSource. applying ( edits)
77
+
77
78
XCTAssertEqual (
78
- edits,
79
- [
80
- TextEdit ( range: Range ( positions [ " 1️⃣ " ] ) , newText: " " ) ,
81
- TextEdit ( range: positions [ " 2️⃣ " ] ..< positions [ " 3️⃣ " ] , newText: " " ) ,
82
- TextEdit ( range: positions [ " 4️⃣ " ] ..< positions [ " 5️⃣ " ] , newText: " " ) ,
83
- ]
79
+ formattedSource,
80
+ """
81
+ func foo() {
82
+ if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
83
+ }
84
+ }
85
+
86
+ """
84
87
)
85
88
}
86
89
You can’t perform that action at this time.
0 commit comments