@@ -1717,9 +1717,12 @@ extension SourceKitLSPServer {
1717
1717
}
1718
1718
} ( )
1719
1719
occurrences += occurrences. flatMap {
1720
- let overrides = index. occurrences ( relatedToUSR: $0. symbol. usr, roles: . overrideOf)
1721
- // Only contain overrides that are children of one of the receiver types or their subtypes.
1722
- return overrides. filter { override in
1720
+ let overriddenUsrs = index. occurrences ( relatedToUSR: $0. symbol. usr, roles: . overrideOf) . map ( \. symbol. usr)
1721
+ let overriddenSymbolDefinitions = overriddenUsrs. compactMap {
1722
+ index. primaryDefinitionOrDeclarationOccurrence ( ofUSR: $0)
1723
+ }
1724
+ // Only contain overrides that are children of one of the receiver types or their subtypes or extensions.
1725
+ return overriddenSymbolDefinitions. filter { override in
1723
1726
override. relations. contains ( where: {
1724
1727
guard $0. roles. contains ( . childOf) else {
1725
1728
return false
@@ -2473,13 +2476,13 @@ fileprivate struct DocumentNotificationRequestQueue {
2473
2476
}
2474
2477
}
2475
2478
2476
- /// Returns the USRs of the subtypes of `usrs` as well as their subtypes, transitively.
2479
+ /// Returns the USRs of the subtypes of `usrs` as well as their subtypes and extensions , transitively.
2477
2480
fileprivate func transitiveSubtypeClosure( ofUsrs usrs: [ String ] , index: CheckedIndex ) -> [ String ] {
2478
2481
var result : [ String ] = [ ]
2479
2482
for usr in usrs {
2480
2483
result. append ( usr)
2481
- let directSubtypes = index. occurrences ( ofUSR: usr, roles: . baseOf) . flatMap { occurrence in
2482
- occurrence. relations. filter { $0. roles. contains ( . baseOf) } . map ( \. symbol. usr)
2484
+ let directSubtypes = index. occurrences ( ofUSR: usr, roles: [ . baseOf, . extendedBy ] ) . flatMap { occurrence in
2485
+ occurrence. relations. filter { $0. roles. contains ( . baseOf) || $0 . roles . contains ( . extendedBy ) } . map ( \. symbol. usr)
2483
2486
}
2484
2487
let transitiveSubtypes = transitiveSubtypeClosure ( ofUsrs: directSubtypes, index: index)
2485
2488
result += transitiveSubtypes
0 commit comments