@@ -5,15 +5,13 @@ let meth = "ocamllsp/merlinCallCompatible"
5
5
6
6
module Request_params = struct
7
7
type t =
8
- { text_document : TextDocumentIdentifier .t
8
+ { uri : Uri .t
9
9
; result_as_sexp : bool
10
10
; command : string
11
11
; args : string list
12
12
}
13
13
14
- let create ~text_document ~result_as_sexp ~command ~args =
15
- { text_document; result_as_sexp; command; args }
16
- ;;
14
+ let create ~uri ~result_as_sexp ~command ~args = { uri; result_as_sexp; command; args }
17
15
18
16
let stringish_of_yojson
19
17
=
@@ -70,18 +68,16 @@ module Request_params = struct
70
68
let result_as_sexp = json |> member " resultAsSexp" |> to_bool in
71
69
let command = json |> member " command" |> to_string in
72
70
let args = args_of_yojson json in
73
- let text_document = TextDocumentIdentifier . t_of_yojson json in
74
- { text_document ; result_as_sexp; command; args }
71
+ let uri = json |> member " uri " |> Uri . t_of_yojson in
72
+ { uri ; result_as_sexp; command; args }
75
73
;;
76
74
77
- let yojson_of_t { text_document; result_as_sexp; command; args } =
78
- match TextDocumentIdentifier. yojson_of_t text_document with
79
- | `Assoc assoc ->
80
- let result_as_sexp = " resultAsSexp" , `Bool result_as_sexp in
81
- let command = " command" , `String command in
82
- let args = " args" , `List (List. map ~f: (fun x -> `String x) args) in
83
- `Assoc (result_as_sexp :: command :: args :: assoc)
84
- | _ -> (* unreachable *) assert false
75
+ let yojson_of_t { uri; result_as_sexp; command; args } =
76
+ let result_as_sexp = " resultAsSexp" , `Bool result_as_sexp in
77
+ let command = " command" , `String command in
78
+ let args = " args" , `List (List. map ~f: (fun x -> `String x) args) in
79
+ let uri = " uri" , Uri. yojson_of_t uri in
80
+ `Assoc [ result_as_sexp; command; args; uri ]
85
81
;;
86
82
end
87
83
@@ -142,13 +138,12 @@ let perform_query action params pipeline =
142
138
let on_request ~params state =
143
139
Fiber. of_thunk (fun () ->
144
140
let params = (Option. value ~default: (`Assoc [] ) params :> Json. t) in
145
- let Request_params. { result_as_sexp; command; args; text_document } =
141
+ let Request_params. { result_as_sexp; command; args; uri } =
146
142
Request_params. t_of_yojson params
147
143
in
148
144
match Merlin_commands.New_commands. (find_command command all_commands) with
149
145
| Merlin_commands.New_commands. Command (_name , _doc , specs , params , action ) ->
150
146
let open Fiber.O in
151
- let uri = text_document.uri in
152
147
let + json = with_pipeline state uri specs args params @@ perform_query action in
153
148
let result =
154
149
if result_as_sexp
0 commit comments