@@ -56,10 +56,10 @@ type anOpen = {
56
56
type moduleData = {
57
57
mutable toplevelDocs: option (string ),
58
58
stamps: Hashtbl . t (int , (string , Location . t , item , option (string ), ((int , int ), (int , int )))),
59
- /* TODO track constructor names, and record attribute names */
60
59
internalReferences: Hashtbl . t (int , list (Location . t )),
61
60
externalReferences: Hashtbl . t (string , list ((list (string ), Location . t , option (string )))),
62
61
exported: Hashtbl . t (string , int ),
62
+ mutable exportedSuffixes: list ((int , string , string )),
63
63
mutable topLevel: list ((string , int )),
64
64
mutable locations: list ((Location . t , Types . type_expr , definition )),
65
65
mutable allOpens: list (anOpen )
@@ -391,11 +391,14 @@ let openReferencesAtPos = ({allOpens} as data, pos) => {
391
391
};
392
392
393
393
let isStampExported = (needle, data) =>
394
- Hashtbl . fold(
395
- (name, stamp, found) => found != None ? found : stamp == needle ? Some (name) : None ,
394
+ switch ( Hashtbl . fold(
395
+ (name, stamp, found) => found != None ? found : stamp == needle ? Some (( name, None ) ) : None ,
396
396
data. exported,
397
397
None
398
- );
398
+ )) {
399
+ | Some (m ) => Some (m)
400
+ | None => data. exportedSuffixes |> Utils . find(((suffixStamp, mainName, suffixName)) => suffixStamp == needle ? Some ((mainName, Some (suffixName))) : None )
401
+ };
399
402
400
403
let highlightsForStamp = (stamp, data) =>
401
404
maybeFound(Hashtbl . find(data. stamps), stamp)
@@ -437,18 +440,6 @@ let rec stampAtPath = (path, data, suffix) =>
437
440
| _ => None
438
441
};
439
442
440
- /* let suffixAtPath = (path, suffix, data) => {
441
- stampAtPath(path, data) |?> stamp => switch stamp {
442
- | `Global(name, children) => Some(`Global(name, children, suffix))
443
- | `Local(stamp) => (maybeFound(Hashtbl.find(Collector.data.stamps), stamp) |?> ((name, loc, item, docs, range)) => {
444
- switch item {
445
- | Type(t) => getSuffix(t, suffix) |?>> ((loc, stamp)) => `Local(stamp)
446
- | _ => None
447
- }
448
- })
449
- }
450
- }; */
451
-
452
443
let stampAtPos = (pos, data) =>
453
444
locationAtPos(pos, data)
454
445
|?> (
@@ -702,19 +693,24 @@ module Get = {
702
693
703
694
switch (typ_type. type_kind) {
704
695
| Types . Type_record (labels , _ ) => {
705
- labels |> List . iter(({Types . ld_id: {stamp, name: lname}, ld_type, ld_loc}) => {
696
+ labels |> List . iter(({Types . ld_id: {stamp: lstamp , name: lname}, ld_type, ld_loc}) => {
706
697
let shortLoc = Utils . clampLocation(ld_loc, String . length(lname));
707
- addStamp(stamp, lname, shortLoc, Attribute (ld_type, name, typ_type), docs);
708
- addLocation(shortLoc, {Types . desc: Types . Tnil , level: 0 , id: 0 }, IsDefinition (stamp));
698
+ addStamp(lstamp, lname, shortLoc, Attribute (ld_type, name, typ_type), docs);
699
+ if (maybeFound(Hashtbl . find(Collector . data. exported), name) == Some (stamp)) {
700
+ Collector . data. exportedSuffixes = [ (lstamp, name, lname), ... Collector . data. exportedSuffixes] ;
701
+ };
702
+ addLocation(shortLoc, {Types . desc: Types . Tnil , level: 0 , id: 0 }, IsDefinition (lstamp));
709
703
})
710
704
}
711
705
| Types . Type_variant (constructors ) => {
712
- constructors |> List . iter(({Types . cd_id: {stamp, name: cname}, cd_loc} as cd) => {
706
+ constructors |> List . iter(({Types . cd_id: {stamp: cstamp , name: cname}, cd_loc} as cd) => {
713
707
let shortLoc = Utils . clampLocation(cd_loc, String . length(cname));
714
- addStamp(stamp, cname, shortLoc, Constructor (cd, name, typ_type), docs);
715
- addLocation(shortLoc, {Types . desc: Types . Tnil , level: 0 , id: 0 }, IsDefinition (stamp));
708
+ addStamp(cstamp, cname, shortLoc, Constructor (cd, name, typ_type), docs);
709
+ addLocation(shortLoc, {Types . desc: Types . Tnil , level: 0 , id: 0 }, IsDefinition (cstamp));
710
+ if (maybeFound(Hashtbl . find(Collector . data. exported), name) == Some (stamp)) {
711
+ Collector . data. exportedSuffixes = [ (cstamp, name, cname), ... Collector . data. exportedSuffixes] ;
712
+ };
716
713
})
717
-
718
714
}
719
715
| _ => ()
720
716
}
@@ -884,6 +880,7 @@ module Get = {
884
880
stamps: Hashtbl . create(100 ),
885
881
internalReferences: Hashtbl . create(100 ),
886
882
externalReferences: Hashtbl . create(100 ),
883
+ exportedSuffixes: [] ,
887
884
exported: Hashtbl . create(10 ),
888
885
allOpens: [] ,
889
886
topLevel: [] ,
0 commit comments