@@ -103,7 +103,7 @@ let hover state ~file ~line ~col ~extra ~package =
103103 in
104104 match hoverText with
105105 | None -> Protocol. null
106- | Some s -> Protocol. stringifyHover {contents = s} )
106+ | Some s -> Protocol. stringifyHover {contents = s})
107107
108108let hover ~path ~line ~col =
109109 let state = TopTypes. empty () in
@@ -124,9 +124,19 @@ let definition state ~file ~line ~col ~extra ~package =
124124 |> List. filter (fun (l , _ ) -> not l.Location. loc_ghost)
125125 in
126126 let pos = Utils. protocolLineColToCmtLoc ~line ~col in
127+
127128 match References. locForPos ~extra: {extra with locations} pos with
128129 | None -> Protocol. null
129130 | Some (_ , loc ) -> (
131+ let zzzTODO =
132+ References. allReferencesForLoc ~paths ForModule:package.pathsForModule
133+ ~file ~extra ~all Modules:package.localModules
134+ ~get Uri:(State. fileForUri state)
135+ ~get Module:(State. fileForModule state ~package )
136+ ~get Extra:(State. extraForModule state ~package )
137+ loc
138+ in
139+
130140 let locIsModule =
131141 match loc with
132142 | SharedTypes. LModule _ | TopLevelModule _ -> true
@@ -151,7 +161,7 @@ let definition state ~file ~line ~col ~extra ~package =
151161 if skipZero then Protocol. null
152162 else
153163 Protocol. stringifyLocation
154- {uri = Uri2. toString uri2; range = Utils. cmtLocToRange loc} )
164+ {uri = Uri2. toString uri2; range = Utils. cmtLocToRange loc})
155165
156166let definition ~path ~line ~col =
157167 let state = TopTypes. empty () in
@@ -180,22 +190,22 @@ let test ~path =
180190 let line = i - 1 in
181191 let col = mlen - 1 in
182192 if mlen > = 3 then (
183- ( match String. sub rest 0 3 with
193+ (match String. sub rest 0 3 with
184194 | "def" ->
185195 print_endline
186- ( " Definition " ^ path ^ " " ^ string_of_int line ^ " :"
187- ^ string_of_int col );
196+ (" Definition " ^ path ^ " " ^ string_of_int line ^ " :"
197+ ^ string_of_int col);
188198 definition ~path ~line ~col
189199 | "hov" ->
190200 print_endline
191- ( " Hover " ^ path ^ " " ^ string_of_int line ^ " :"
192- ^ string_of_int col );
201+ (" Hover " ^ path ^ " " ^ string_of_int line ^ " :"
202+ ^ string_of_int col);
193203
194204 hover ~path ~line ~col
195205 | "com" ->
196206 print_endline
197- ( " Complete " ^ path ^ " " ^ string_of_int line ^ " :"
198- ^ string_of_int col );
207+ (" Complete " ^ path ^ " " ^ string_of_int line ^ " :"
208+ ^ string_of_int col);
199209 let currentFile, cout = Filename. open_temp_file " def" " txt" in
200210 lines
201211 |> List. iteri (fun j l ->
@@ -208,7 +218,7 @@ let test ~path =
208218 close_out cout;
209219 complete ~path ~line ~col ~current File;
210220 Sys. remove currentFile
211- | _ -> () );
212- print_newline () )
221+ | _ -> () );
222+ print_newline () )
213223 in
214224 lines |> List. iteri processLine
0 commit comments