@@ -459,15 +459,30 @@ let forLocalStamp ~full:{file; extra; package} stamp tip =
459
459
let allReferencesForLocItem ~full :({file; package} as full ) locItem =
460
460
match locItem.locType with
461
461
| TopLevelModule moduleName ->
462
- let locs =
463
- match Hashtbl. find_opt full.extra.fileReferences moduleName with
462
+ let otherModulesReferences =
463
+ package.localModules
464
+ |> Utils. filterMap (fun name ->
465
+ match ProcessCmt. fileForModule ~package name with
466
+ | None -> None
467
+ | Some file -> ProcessCmt. getFullFromCmt ~uri: file.uri)
468
+ |> List. map (fun full ->
469
+ match Hashtbl. find_opt full.extra.fileReferences moduleName with
470
+ | None -> []
471
+ | Some locs ->
472
+ locs
473
+ |> List. map (fun loc ->
474
+ (Uri2. fromPath loc.Location. loc_start.pos_fname, [loc])))
475
+ |> List. flatten
476
+ in
477
+ let targetModuleReference =
478
+ match Hashtbl. find_opt package.pathsForModule moduleName with
464
479
| None -> []
465
- | Some locs ->
466
- locs
467
- |> List. map ( fun loc ->
468
- (Uri2. fromPath loc. Location. loc_start.pos_fname , [loc]) )
480
+ | Some paths -> (
481
+ match SharedTypes. getSrc paths with
482
+ | None -> []
483
+ | Some src -> [ (Uri2. fromPath src , [Utils. topLoc src])] )
469
484
in
470
- locs
485
+ List. append targetModuleReference otherModulesReferences
471
486
| Typed (_ , _ , NotFound ) | LModule NotFound | Constant _ -> []
472
487
| TypeDefinition (_ , _ , stamp ) -> forLocalStamp ~full stamp Type
473
488
| Typed (_, _, (LocalReference (stamp, tip) | Definition (stamp, tip)))
0 commit comments