Source file query_protocol.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
module Compl = struct
type 'desc raw_entry =
{ name : string;
kind :
[ `Value
| `Constructor
| `Variant
| `Label
| `Module
| `Modtype
| `Type
| `MethodCall
| `Keyword ];
desc : 'desc;
info : 'desc;
deprecated : bool;
ppx_template_generated : bool
(** [true] if the identifier was generated by ppx_template *)
}
type entry = string raw_entry
type application_context =
{ argument_type : string; labels : (string * string) list }
type t =
{ entries : entry list;
context : [ `Unknown | `Application of application_context ]
}
type kind =
[ `Constructor
| `Labels
| `Modules
| `Modules_type
| `Types
| `Values
| `Variants
| `Keywords ]
end
type completions = Compl.t
type 'a type_search_result =
{ name : string;
typ : 'a;
loc : Location_aux.t;
doc : string option;
cost : int;
constructible : string
}
type outline = item list
and item =
{ outline_name : string;
outline_kind :
[ `Value
| `Constructor
| `Label
| `Module
| `Modtype
| `Type
| `Exn
| `Class
| `Method ];
outline_type : string option;
deprecated : bool;
location : Location_aux.t;
children : outline
}
type shape = { shape_loc : Location_aux.t; shape_sub : shape list }
type error_filter = { lexing : bool; parsing : bool; typing : bool }
module Syntax_doc_result = struct
module Level = struct
type t = Simple | Advanced
end
type t =
{ name : string;
description : string;
documentation : string option;
level : Level.t
}
end
type ppxed_source =
{ code : string; attr_start : Lexing.position; attr_end : Lexing.position }
type signature_help_param = { label_start : int; label_end : int }
type signature_help_result =
{ label : string;
parameters : signature_help_param list;
active_param : int;
active_signature : int
}
type trigger_kind = Invoked | Trigger_character of string | Content_change
type signature_help =
{ position : Msource.position;
trigger_kind : trigger_kind option;
is_retrigger : bool;
active_signature_help : signature_help_result option
}
type is_tail_position = [ `No | `Tail_position | `Tail_call ]
type _ _bool = bool
type occurrences_status =
[ `Not_requested | `Out_of_sync of string list | `No_def | `Included ]
type occurrence = { loc : Location.t; is_stale : bool }
module Locate_context = struct
type t =
| Expr
| Module_path
| Module_type
| Patt
| Type
| Constant
| Constructor
| Label
| Unknown
let to_string = function
| Expr -> "expr"
| Module_path -> "module_path"
| Module_type -> "module_type"
| Patt -> "pattern"
| Type -> "type"
| Constant -> "constant"
| Constructor -> "constructor"
| Label -> "label"
| Unknown -> "unknown"
let of_string = function
| "expr" -> Some Expr
| "module_path" -> Some Module_path
| "module_type" -> Some Module_type
| "pattern" -> Some Patt
| "type" -> Some Type
| "constant" -> Some Constant
| "constructor" -> Some Constructor
| "label" -> Some Label
| "unknown" -> Some Unknown
| _ -> None
let all =
[ Expr;
Module_path;
Module_type;
Patt;
Type;
Constant;
Constructor;
Label;
Unknown
]
end
type _ t =
| Type_expr : string * Msource.position -> string t
| Stack_or_heap_enclosing :
Msource.position * bool * int option
-> (Location.t * [ `String of string | `Index of int ]) list t
| Type_enclosing :
(string * int) option * Msource.position * int option
-> (Location.t * [ `String of string | `Index of int ] * is_tail_position)
list
t
| Enclosing : Msource.position -> Location.t list t
| Complete_prefix :
string
* Msource.position
* Compl.kind list
* [ `with_documentation ] _bool
* [ `with_types ] _bool
-> completions t
| Expand_prefix :
string * Msource.position * Compl.kind list * [ `with_types ] _bool
-> completions t
| Polarity_search : string * Msource.position -> completions t
| Type_search :
string * Msource.position * int * bool
-> string type_search_result list t
| Refactor_open :
[ `Qualify | `Unqualify ] * Msource.position
-> (string * Location.t) list t
| Document :
string option * Msource.position
-> [ `Found of string
| `Invalid_context
| `Builtin of string
| `Not_in_env of string
| `File_not_found of string
| `Not_found of string * string option
| `No_documentation ]
t
| Syntax_document :
Msource.position
-> [ `Found of Syntax_doc_result.t | `No_documentation ] t
| Expand_ppx : Msource.position -> [ `Found of ppxed_source | `No_ppx ] t
| Locate_type :
Msource.position
-> [ `Found of string option * Lexing.position
| `Invalid_context
| `Builtin of string
| `Not_in_env of string
| `File_not_found of string
| `Not_found of string * string option
| `At_origin ]
t
| Locate :
string option
* [ `ML | `MLI ]
* Msource.position
* Locate_context.t option
-> [ `Found of string option * Lexing.position
| `Invalid_context
| `Builtin of string
| `Not_in_env of string
| `File_not_found of string
| `Not_found of string * string option
| `At_origin ]
t
| Jump :
string * Msource.position
-> [ `Found of Lexing.position | `Error of string ] t
| Phrase : [ `Next | `Prev ] * Msource.position -> Lexing.position t
| Case_analysis :
Msource.position * Msource.position
-> (Location.t * string) t
| Holes : (Location.t * string) list t
| Construct :
Msource.position * [ `None | `Local ] option * int option
-> (Location.t * string list) t
| Inlay_hints :
Msource.position * Msource.position * bool * bool * bool
-> (Lexing.position * string) list t
| Outline : { include_types : bool } -> outline t
| Shape : Msource.position -> shape list t
| Errors : error_filter -> Location.error list t
| Dump : Std.json list -> Std.json t
| Path_of_source : string list -> string t
| List_modules : string list -> string list t
| Findlib_list : string list t
| Extension_list : [ `All | `Enabled | `Disabled ] -> string list t
| Path_list : [ `Build | `Source ] -> string list t
| Occurrences :
[ `Ident_at of Msource.position ] * [ `Project | `Buffer | `Renaming ]
-> (occurrence list * occurrences_status) t
| Signature_help : signature_help -> signature_help_result option t
(** In current version, Merlin only uses the parameter [position] to answer
signature_help queries. The additionnal parameters are described in the
LSP protocol and might enable finer behaviour in the future. *)
| Version : (string * Config.Magic_numbers.t) t