Skip to content

Commit fdf3b44

Browse files
committed
Update InlayHintsTests
The annotations are now (correctly) displayed after the variable identifiers rather than after the bound expressions.
1 parent 7e376e0 commit fdf3b44

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

Tests/SourceKitLSPTests/InlayHintsTests.swift

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,15 @@ final class InlayHintsTests: XCTestCase {
6767
let x = 4
6868
var y = "test" + "123"
6969
"""
70-
// FIXME: These type hints should ideally be displayed after the variable name
71-
// rather than after the expression. Once the implementation is updated (e.g.
72-
// by using a new SourceKit request), these tests should be updated too.
7370
let hints = performInlayHintsRequest(text: text)
7471
XCTAssertEqual(hints, [
7572
InlayHint(
76-
position: Position(line: 0, utf16index: 9),
73+
position: Position(line: 0, utf16index: 5),
7774
category: .type,
7875
label: "Int"
7976
),
8077
InlayHint(
81-
position: Position(line: 1, utf16index: 22),
78+
position: Position(line: 1, utf16index: 5),
8279
category: .type,
8380
label: "String"
8481
),
@@ -102,12 +99,12 @@ final class InlayHintsTests: XCTestCase {
10299
let hints = performInlayHintsRequest(text: text, range: range)
103100
XCTAssertEqual(hints, [
104101
InlayHint(
105-
position: Position(line: 6, utf16index: 23),
102+
position: Position(line: 6, utf16index: 10),
106103
category: .type,
107104
label: "Bool"
108105
),
109106
InlayHint(
110-
position: Position(line: 7, utf16index: 43),
107+
position: Position(line: 7, utf16index: 12),
111108
category: .type,
112109
label: "Int"
113110
)
@@ -133,27 +130,27 @@ final class InlayHintsTests: XCTestCase {
133130
let hints = performInlayHintsRequest(text: text)
134131
XCTAssertEqual(hints, [
135132
InlayHint(
136-
position: Position(line: 1, utf16index: 24),
133+
position: Position(line: 1, utf16index: 20),
137134
category: .type,
138135
label: "Int"
139136
),
140137
InlayHint(
141-
position: Position(line: 2, utf16index: 33),
138+
position: Position(line: 2, utf16index: 25),
142139
category: .type,
143140
label: "String"
144141
),
145142
InlayHint(
146-
position: Position(line: 6, utf16index: 36),
143+
position: Position(line: 6, utf16index: 20),
147144
category: .type,
148145
label: "String"
149146
),
150147
InlayHint(
151-
position: Position(line: 7, utf16index: 33),
148+
position: Position(line: 7, utf16index: 25),
152149
category: .type,
153150
label: "Int"
154151
),
155152
InlayHint(
156-
position: Position(line: 11, utf16index: 31),
153+
position: Position(line: 11, utf16index: 25),
157154
category: .type,
158155
label: "Double"
159156
),
@@ -169,20 +166,8 @@ final class InlayHintsTests: XCTestCase {
169166
}
170167
"""
171168
let hints = performInlayHintsRequest(text: text)
172-
// FIXME: Explicitly type-annotated variable bindings shouldn't have
173-
// an inlay hint. Once we move to the new SourceKit request (as detailed
174-
// in the other comment above), we should receive the empty array here.
175-
XCTAssertEqual(hints, [
176-
InlayHint(
177-
position: Position(line: 0, utf16index: 21),
178-
category: .type,
179-
label: "String"
180-
),
181-
InlayHint(
182-
position: Position(line: 3, utf16index: 17),
183-
category: .type,
184-
label: "Int"
185-
)
186-
])
169+
XCTAssertEqual(hints, [])
187170
}
171+
172+
// TODO: Add test for closure parameters
188173
}

0 commit comments

Comments
 (0)