@@ -2031,6 +2031,7 @@ extension SourceKitLSPServer {
20312031 // callOccurrences are all the places that any of the USRs in callableUsrs is called.
20322032 // We also load the `calledBy` roles to get the method that contains the reference to this call.
20332033 let callOccurrences = callableUsrs. flatMap { index. occurrences ( ofUSR: $0, roles: . containedBy) }
2034+ . filter ( \. shouldShowInCallHierarchy)
20342035
20352036 // Maps functions that call a USR in `callableUSRs` to all the called occurrences of `callableUSRs` within the
20362037 // function. If a function `foo` calls `bar` multiple times, `callersToCalls[foo]` will contain two call
@@ -2101,6 +2102,7 @@ extension SourceKitLSPServer {
21012102
21022103 let callableUsrs = [ data. usr] + index. occurrences ( relatedToUSR: data. usr, roles: . accessorOf) . map ( \. symbol. usr)
21032104 let callOccurrences = callableUsrs. flatMap { index. occurrences ( relatedToUSR: $0, roles: . containedBy) }
2105+ . filter ( \. shouldShowInCallHierarchy)
21042106 let calls = callOccurrences. compactMap { occurrence -> CallHierarchyOutgoingCall ? in
21052107 guard occurrence. symbol. kind. isCallable else {
21062108 return nil
@@ -2504,6 +2506,13 @@ extension IndexSymbolKind {
25042506 }
25052507}
25062508
2509+ fileprivate extension SymbolOccurrence {
2510+ /// Whether this is a call-like occurrence that should be shown in the call hierarchy.
2511+ var shouldShowInCallHierarchy : Bool {
2512+ !roles. intersection ( [ . addressOf, . call, . read, . reference, . write] ) . isEmpty
2513+ }
2514+ }
2515+
25072516/// Simple struct for pending notifications/requests, including a cancellation handler.
25082517/// For convenience the notifications/request handlers are type erased via wrapping.
25092518fileprivate struct NotificationRequestOperation {
0 commit comments