@@ -90,7 +90,7 @@ final class CallHierarchyTests: XCTestCase {
90
90
func item(
91
91
_ name: String ,
92
92
_ kind: SymbolKind ,
93
- detail: String = " test " ,
93
+ detail: String ? = nil ,
94
94
usr: String ,
95
95
at position: Position
96
96
) -> CallHierarchyItem {
@@ -215,7 +215,7 @@ final class CallHierarchyTests: XCTestCase {
215
215
name: " foo " ,
216
216
kind: . method,
217
217
tags: nil ,
218
- detail: " " ,
218
+ detail: " FilePathIndex " ,
219
219
uri: try project. uri ( for: " lib.cpp " ) ,
220
220
range: try Range ( project. position ( of: " 2️⃣ " , in: " lib.cpp " ) ) ,
221
221
selectionRange: try Range ( project. position ( of: " 2️⃣ " , in: " lib.cpp " ) ) ,
@@ -255,7 +255,7 @@ final class CallHierarchyTests: XCTestCase {
255
255
name: " testFunc(x:) " ,
256
256
kind: . function,
257
257
tags: nil ,
258
- detail: " test " , // test is the module name because the file is called test.swift
258
+ detail: nil ,
259
259
uri: project. fileURI,
260
260
range: Range ( project. positions [ " 2️⃣ " ] ) ,
261
261
selectionRange: Range ( project. positions [ " 2️⃣ " ] ) ,
@@ -297,7 +297,7 @@ final class CallHierarchyTests: XCTestCase {
297
297
name: " getter:testVar " ,
298
298
kind: . function,
299
299
tags: nil ,
300
- detail: " test " , // test is the module name because the file is called test.swift
300
+ detail: nil ,
301
301
uri: project. fileURI,
302
302
range: Range ( project. positions [ " 2️⃣ " ] ) ,
303
303
selectionRange: Range ( project. positions [ " 2️⃣ " ] ) ,
@@ -339,7 +339,7 @@ final class CallHierarchyTests: XCTestCase {
339
339
name: " testFunc() " ,
340
340
kind: . function,
341
341
tags: nil ,
342
- detail: " test " , // test is the module name because the file is called test.swift
342
+ detail: nil ,
343
343
uri: project. fileURI,
344
344
range: Range ( project. positions [ " 2️⃣ " ] ) ,
345
345
selectionRange: Range ( project. positions [ " 2️⃣ " ] ) ,
@@ -355,7 +355,7 @@ final class CallHierarchyTests: XCTestCase {
355
355
name: " testFunc() " ,
356
356
kind: . function,
357
357
tags: nil ,
358
- detail: " test " , // test is the module name because the file is called test.swift
358
+ detail: nil ,
359
359
uri: project. fileURI,
360
360
range: Range ( project. positions [ " 2️⃣ " ] ) ,
361
361
selectionRange: Range ( project. positions [ " 2️⃣ " ] ) ,
@@ -396,7 +396,7 @@ final class CallHierarchyTests: XCTestCase {
396
396
name: " getter:foo " ,
397
397
kind: . function,
398
398
tags: nil ,
399
- detail: " test " , // test is the module name because the file is called test.swift
399
+ detail: nil ,
400
400
uri: project. fileURI,
401
401
range: Range ( project. positions [ " 1️⃣ " ] ) ,
402
402
selectionRange: Range ( project. positions [ " 1️⃣ " ] ) ,
@@ -436,7 +436,7 @@ final class CallHierarchyTests: XCTestCase {
436
436
name: " testFunc() " ,
437
437
kind: . function,
438
438
tags: nil ,
439
- detail: " test " , // test is the module name because the file is called test.swift
439
+ detail: nil ,
440
440
uri: project. fileURI,
441
441
range: Range ( project. positions [ " 1️⃣ " ] ) ,
442
442
selectionRange: Range ( project. positions [ " 1️⃣ " ] ) ,
@@ -485,7 +485,7 @@ final class CallHierarchyTests: XCTestCase {
485
485
name: " test(proto:) " ,
486
486
kind: . function,
487
487
tags: nil ,
488
- detail: " test " , // test is the module name because the file is called test.swift
488
+ detail: nil ,
489
489
uri: project. fileURI,
490
490
range: Range ( project. positions [ " 2️⃣ " ] ) ,
491
491
selectionRange: Range ( project. positions [ " 2️⃣ " ] ) ,
@@ -534,7 +534,7 @@ final class CallHierarchyTests: XCTestCase {
534
534
name: " test(base:) " ,
535
535
kind: . function,
536
536
tags: nil ,
537
- detail: " test " , // test is the module name because the file is called test.swift
537
+ detail: nil ,
538
538
uri: project. fileURI,
539
539
range: Range ( project. positions [ " 2️⃣ " ] ) ,
540
540
selectionRange: Range ( project. positions [ " 2️⃣ " ] ) ,
@@ -548,4 +548,47 @@ final class CallHierarchyTests: XCTestCase {
548
548
]
549
549
)
550
550
}
551
+
552
+ func testCallHierarchyContainsContainerNameAsDetail( ) async throws {
553
+ let project = try await IndexedSingleSwiftFileTestProject (
554
+ """
555
+ class MyClass {
556
+ func 1️⃣foo() {
557
+ 2️⃣bar()
558
+ }
559
+ }
560
+ func 3️⃣bar() {
561
+ }
562
+ """
563
+ )
564
+ let prepare = try await project. testClient. send (
565
+ CallHierarchyPrepareRequest (
566
+ textDocument: TextDocumentIdentifier ( project. fileURI) ,
567
+ position: project. positions [ " 3️⃣ " ]
568
+ )
569
+ )
570
+ let initialItem = try XCTUnwrap ( prepare? . only)
571
+ let calls = try await project. testClient. send ( CallHierarchyIncomingCallsRequest ( item: initialItem) )
572
+ XCTAssertEqual (
573
+ calls,
574
+ [
575
+ CallHierarchyIncomingCall (
576
+ from: CallHierarchyItem (
577
+ name: " foo() " ,
578
+ kind: . method,
579
+ tags: nil ,
580
+ detail: " MyClass " ,
581
+ uri: project. fileURI,
582
+ range: Range ( project. positions [ " 1️⃣ " ] ) ,
583
+ selectionRange: Range ( project. positions [ " 1️⃣ " ] ) ,
584
+ data: . dictionary( [
585
+ " usr " : . string( " s:4test7MyClassC3fooyyF " ) ,
586
+ " uri " : . string( project. fileURI. stringValue) ,
587
+ ] )
588
+ ) ,
589
+ fromRanges: [ Range ( project. positions [ " 2️⃣ " ] ) ]
590
+ )
591
+ ]
592
+ )
593
+ }
551
594
}
0 commit comments