@@ -19,7 +19,7 @@ let locItemsForPos ~extra pos =
19
19
20
20
let locItemForPos ~full pos =
21
21
let locItems = locItemsForPos ~extra: full.extra pos in
22
- if ! Log. spamError then
22
+ if ! Log. spamError then
23
23
print_endline
24
24
(" locItems:\n "
25
25
^ (locItems |> List. map locItemToString |> String. concat " \n " ));
@@ -34,7 +34,10 @@ let locItemForPos ~full pos =
34
34
] ->
35
35
(* heuristic for </Comp> within a fragment *)
36
36
None
37
- | [{locType = Constant _}; ({locType = Typed (" createDOMElementVariadic" , _, _)} as li2)] ->
37
+ | [
38
+ {locType = Constant _};
39
+ ({locType = Typed (" createDOMElementVariadic" , _, _)} as li2);
40
+ ] ->
38
41
(* heuristic for <div> *)
39
42
Some li2
40
43
| {locType = Typed (" makeProps" , _, _)}
@@ -464,8 +467,16 @@ let forLocalStamp ~full:{file; extra; package} stamp tip =
464
467
465
468
let allReferencesForLocItem ~full :({file; package} as full ) locItem =
466
469
match locItem.locType with
467
- | Typed (_ , _ , NotFound ) | LModule NotFound | TopLevelModule _ | Constant _ ->
468
- []
470
+ | TopLevelModule moduleName -> (
471
+ match Hashtbl. find_opt package.pathsForModule moduleName with
472
+ | None -> []
473
+ | Some paths -> (
474
+ match getSrc paths with
475
+ | None -> []
476
+ | Some src ->
477
+ let uri, loc = (Uri2. fromPath src, Utils. topLoc src) in
478
+ [(uri, [loc])]))
479
+ | Typed (_ , _ , NotFound ) | LModule NotFound | Constant _ -> []
469
480
| TypeDefinition (_ , _ , stamp ) -> forLocalStamp ~full stamp Type
470
481
| Typed (_, _, (LocalReference (stamp, tip) | Definition (stamp, tip)))
471
482
| LModule (LocalReference (stamp , tip ) | Definition (stamp , tip )) ->
0 commit comments