File tree Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ let references ~path ~line ~col =
130130 let loc =
131131 match locOpt with
132132 | Some loc -> loc
133- | None -> Utils. topLoc ( Uri2. toPath uri2)
133+ | None -> Uri2. toTopLevelLoc uri2
134134 in
135135 Protocol. stringifyLocation
136136 {uri = Uri2. toString uri2; range = Utils. cmtLocToRange loc}
Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ let resolveModuleDefinition ~(file : File.t) ~package stamp =
279279 | Some (file , declared ) ->
280280 let loc =
281281 match declared with
282- | None -> Utils. topLoc ( Uri2. toPath file.uri)
282+ | None -> Uri2. toTopLevelLoc file.uri
283283 | Some declared -> validateLoc declared.name.loc declared.extentLoc
284284 in
285285 Some (file.uri, loc))
@@ -332,7 +332,7 @@ let definitionForLocItem ~full:{file; package} locItem =
332332 | None -> None
333333 | Some paths ->
334334 let uri = getUri paths in
335- Some (uri, Utils. topLoc ( Uri2. toPath uri) ))
335+ Some (uri, Uri2. toTopLevelLoc uri))
336336 | LModule (LocalReference (stamp, tip))
337337 | Typed (_ , _ , LocalReference (stamp , tip )) ->
338338 maybeLog (" Local defn " ^ tipToString tip);
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ module Uri : sig
1010 val toPath : t -> string
1111
1212 val toString : t -> string
13+
14+ val toTopLevelLoc : t -> Location .t
1315end = struct
1416 type t = {path : string ; uri : string }
1517
@@ -30,6 +32,12 @@ end = struct
3032
3133 let toPath {path} = path
3234
35+ let toTopLevelLoc {path} =
36+ let topPos =
37+ {Lexing. pos_fname = path; pos_lnum = 1 ; pos_bol = 0 ; pos_cnum = 0 }
38+ in
39+ {Location. loc_start = topPos; Location. loc_end = topPos; loc_ghost = false }
40+
3341 let toString {uri} = if ! stripPath then Filename. basename uri else uri
3442end
3543
Original file line number Diff line number Diff line change 1- let topLoc fname =
2- {
3- Location. loc_start =
4- {Lexing. pos_fname = fname; pos_lnum = 1 ; pos_bol = 0 ; pos_cnum = 0 };
5- Location. loc_end =
6- {Lexing. pos_fname = fname; pos_lnum = 1 ; pos_bol = 0 ; pos_cnum = 0 };
7- loc_ghost = false ;
8- }
9-
101(* *
112 * `startsWith(string, prefix)`
123 * true if the string starts with the prefix
You can’t perform that action at this time.
0 commit comments