forked from ejgallego/coq-lsp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.mli
124 lines (105 loc) · 3.22 KB
/
base.mli
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
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
(************************************************************************)
(* Coq Language Server Protocol *)
(* Copyright 2019 MINES ParisTech -- LGPL 2.1+ *)
(* Copyright 2019-2023 Inria -- LGPL 2.1+ *)
(* Written by: Emilio J. Gallego Arias *)
(************************************************************************)
(* XXX: EJGA This should be an structured value (object or array) *)
module Params : sig
type t = (string * Yojson.Safe.t) list
end
module Notification : sig
type t =
{ method_ : string
; params : Params.t
}
[@@deriving to_yojson]
val make : method_:string -> params:Params.t -> unit -> t
end
module Request : sig
type t =
{ id : int
; method_ : string
; params : Params.t
}
[@@deriving to_yojson]
val make : method_:string -> id:int -> params:Params.t -> unit -> t
end
(* Request response *)
module Response : sig
type t =
| Ok of
{ id : int
; result : Yojson.Safe.t
}
| Error of
{ id : int
; code : int
; message : string
; data : Yojson.Safe.t option
}
[@@deriving to_yojson]
(** Answer to a request *)
val mk_ok : id:int -> result:Yojson.Safe.t -> t
(** Fail a request *)
val mk_error : id:int -> code:int -> message:string -> t
val id : t -> int
end
(** Basic JSON-RPC Incoming Messages *)
module Message : sig
type t =
| Notification of Notification.t
| Request of Request.t
| Response of Response.t
[@@deriving yojson]
val notification : Notification.t -> t
val response : Response.t -> t
end
(** Build request *)
(** Progress *)
module ProgressToken : sig
type t =
| String of string
| Int of int
[@@deriving yojson]
end
module ProgressParams : sig
type 'a t =
{ token : ProgressToken.t
; value : 'a
}
[@@deriving yojson]
end
val mk_progress :
token:ProgressToken.t -> value:'a -> ('a -> Yojson.Safe.t) -> Yojson.Safe.t
module WorkDoneProgressBegin : sig
type t =
{ kind : string
; title : string
; cancellable : bool option [@None]
; message : string option [@None]
; percentage : int option [@None]
}
[@@deriving to_yojson]
end
module WorkDoneProgressReport : sig
type t =
{ kind : string
; cancellable : bool option [@None]
; message : string option [@None]
; percentage : int option [@None]
}
[@@deriving to_yojson]
end
module WorkDoneProgressEnd : sig
type t = { kind : string } [@@deriving to_yojson]
end