@@ -220,16 +220,19 @@ final class SwiftInterfaceTests: XCTestCase {
220
220
)
221
221
222
222
let ( mainUri, mainPositions) = try project. openDocument ( " main.swift " )
223
- let response = try await project. testClient. send (
224
- DefinitionRequest ( textDocument: TextDocumentIdentifier ( mainUri) , position: mainPositions [ " 1️⃣ " ] )
225
- )
223
+ let response =
224
+ try await project. testClient. send (
225
+ DefinitionRequest (
226
+ textDocument: TextDocumentIdentifier ( mainUri) ,
227
+ position: mainPositions [ " 1️⃣ " ]
228
+ )
229
+ )
226
230
let referenceDocumentUri = try XCTUnwrap ( response? . locations? . only) . uri
227
231
let referenceDocument = try await project. testClient. send ( GetReferenceDocumentRequest ( uri: referenceDocumentUri) )
228
-
229
- // Test hover functionality in the interface
230
232
let stringIndex = try XCTUnwrap ( referenceDocument. content. firstRange ( of: " -> String " ) )
231
- let ( line , column ) = LineTable ( referenceDocument. content)
233
+ let ( stringLine , stringColumn ) = LineTable ( referenceDocument. content)
232
234
. lineAndUTF16ColumnOf ( referenceDocument. content. index ( stringIndex. lowerBound, offsetBy: 3 ) )
235
+
233
236
project. testClient. send (
234
237
DidOpenTextDocumentNotification (
235
238
textDocument: TextDocumentItem (
@@ -243,7 +246,7 @@ final class SwiftInterfaceTests: XCTestCase {
243
246
let hover = try await project. testClient. send (
244
247
HoverRequest (
245
248
textDocument: TextDocumentIdentifier ( referenceDocumentUri) ,
246
- position: Position ( line: line , utf16index: column )
249
+ position: Position ( line: stringLine , utf16index: stringColumn )
247
250
)
248
251
)
249
252
XCTAssertNotNil ( hover)
@@ -296,7 +299,6 @@ final class SwiftInterfaceTests: XCTestCase {
296
299
GetReferenceDocumentRequest . method: . dictionary( [ " supported " : . bool( true ) ] )
297
300
] )
298
301
)
299
-
300
302
let uri = DocumentURI ( for: . swift)
301
303
302
304
let positions = testClient. openDocument (
@@ -322,49 +324,6 @@ final class SwiftInterfaceTests: XCTestCase {
322
324
XCTAssertEqual ( diagnostics. fullReport? . items, [ ] )
323
325
}
324
326
325
- func testInternalNavigationInSwiftInterface( ) async throws {
326
- let testClient = try await TestSourceKitLSPClient (
327
- capabilities: ClientCapabilities ( experimental: [
328
- GetReferenceDocumentRequest . method: . dictionary( [ " supported " : . bool( true ) ] )
329
- ] )
330
- )
331
- let uri = DocumentURI ( for: . swift)
332
-
333
- let positions = testClient. openDocument (
334
- """
335
- func test(x: 1️⃣String) {}
336
- """ ,
337
- uri: uri
338
- )
339
-
340
- // First, get definition for String to open the Swift interface
341
- let stringDefinition = try await testClient. send (
342
- DefinitionRequest ( textDocument: TextDocumentIdentifier ( uri) , position: positions [ " 1️⃣ " ] )
343
- )
344
- let interfaceUri = try XCTUnwrap ( stringDefinition? . locations? . only? . uri)
345
- let interfaceContents = try await testClient. send ( GetReferenceDocumentRequest ( uri: interfaceUri) )
346
- // Open the interface document
347
- testClient. openDocument ( interfaceContents. content, uri: interfaceUri, language: . swift)
348
-
349
- // Find a symbol within the interface (e.g., "init" method in String)
350
- let initRange = try XCTUnwrap ( interfaceContents. content. range ( of: " public init() " ) )
351
- let lineTable = LineTable ( interfaceContents. content)
352
- let ( line, column) = lineTable. lineAndUTF16ColumnOf ( initRange. lowerBound)
353
- let initPosition = Position ( line: line, utf16index: column + 7 ) // Position on "init"
354
-
355
- // Test definition request within the interface
356
- let internalDefinition = try await testClient. send (
357
- DefinitionRequest (
358
- textDocument: TextDocumentIdentifier ( interfaceUri) ,
359
- position: initPosition
360
- )
361
- )
362
-
363
- let location = try XCTUnwrap ( internalDefinition? . locations? . first)
364
- XCTAssertTrue ( location. uri. pseudoPath. hasSuffix ( " .swiftinterface " ) )
365
- XCTAssertTrue ( location. uri == interfaceUri)
366
- }
367
-
368
327
func testFoundationImportNavigation( ) async throws {
369
328
let testClient = try await TestSourceKitLSPClient (
370
329
capabilities: ClientCapabilities ( experimental: [
0 commit comments