this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add type_enclosing action

+28 -9
+9
merlinjs/client/merlin_client.ml
··· 55 55 match data with 56 56 | Protocol.Completions compl -> compl 57 57 | _ -> assert false 58 + 59 + let query_type worker (source : string) position = 60 + let open Fut.Syntax in 61 + let action = Protocol.Type_enclosing (source, position) in 62 + let+ data : Protocol.answer = query ~action worker in 63 + Console.(log ["Received typed enclosings:"; data]); 64 + match data with 65 + | Protocol.Typed_enclosings l -> l 66 + | _ -> assert false
+3 -7
merlinjs/merlin_worker.ml
··· 156 156 | None -> 157 157 Protocol.Completions { from = 0; to_ = 0; entries = []; } 158 158 end 159 - 160 - (* 161 - | Type_enclosing -> failwith "toto" 159 + | Type_enclosing (source, position) -> 160 + let source = Msource.make source in 162 161 let query = Query_protocol.Type_enclosing (None, position, None) in 163 - let result_string = dispatch source query in 164 - Brr.Json.decode @@ Jstr.of_string result_string 165 - |> Stdlib.Result.get_ok *) 162 + Protocol.Typed_enclosings (dispatch source query) 166 163 | Protocol.All_errors source -> 167 164 Console.(log ["w: Query errors"]); 168 165 let source = Msource.make source in ··· 192 189 }) 193 190 in 194 191 Protocol.Errors errors 195 - | _ -> failwith "not implemented" 196 192 in 197 193 let res = Marshal.to_bytes res [] in 198 194 Brr_webworkers.Worker.G.post res
+16 -2
merlinjs/protocol/protocol.ml
··· 2 2 module Location = Ocaml_parsing.Location 3 3 4 4 type source = string 5 - type action = Complete_prefix of source * Msource.position | Type_enclosing | All_errors of source 5 + 6 + type action = 7 + | Complete_prefix of source * Msource.position 8 + | Type_enclosing of source * Msource.position 9 + | All_errors of source 10 + 6 11 type error = { 7 12 kind : Location.report_kind; 8 13 loc: Location.t; ··· 10 15 sub : string list; 11 16 source : Location.error_source; 12 17 } 18 + 13 19 type completions = { 14 20 from: int; 15 21 to_: int; 16 22 entries : Query_protocol.Compl.entry list 17 23 } 24 + 25 + type is_tail_position = 26 + [`No | `Tail_position | `Tail_call] 27 + 18 28 (* type errors = { from: int; to_: int; entries: error list } *) 19 - type answer = Errors of error list | Completions of completions 29 + type answer = 30 + | Errors of error list 31 + | Completions of completions 32 + | Typed_enclosings of 33 + (Location.t * [ `Index of int | `String of string ] * is_tail_position) list 20 34 21 35 let report_source_to_string = function 22 36 | Location.Lexer -> "lexer"