massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-json / node_modules / vscode-jsonrpc / lib / common / messages.d.ts
1 /**
2  * A language server message
3  */
4 export interface Message {
5     jsonrpc: string;
6 }
7 /**
8  * Request message
9  */
10 export interface RequestMessage extends Message {
11     /**
12      * The request id.
13      */
14     id: number | string | null;
15     /**
16      * The method to be invoked.
17      */
18     method: string;
19     /**
20      * The method's params.
21      */
22     params?: any[] | object;
23 }
24 /**
25  * Predefined error codes.
26  */
27 export declare namespace ErrorCodes {
28     const ParseError: number;
29     const InvalidRequest: number;
30     const MethodNotFound: number;
31     const InvalidParams: number;
32     const InternalError: number;
33     /**
34      * This is the start range of JSON RPC reserved error codes.
35      * It doesn't denote a real error code. No application error codes should
36      * be defined between the start and end range. For backwards
37      * compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
38      * are left in the range.
39      *
40      * @since 3.16.0
41     */
42     const jsonrpcReservedErrorRangeStart: number;
43     /** @deprecated use  jsonrpcReservedErrorRangeStart */
44     const serverErrorStart: number;
45     const MessageWriteError: number;
46     const MessageReadError: number;
47     const ServerNotInitialized: number;
48     const UnknownErrorCode: number;
49     /**
50      * This is the end range of JSON RPC reserved error codes.
51      * It doesn't denote a real error code.
52      *
53      * @since 3.16.0
54     */
55     const jsonrpcReservedErrorRangeEnd = -32000;
56     /** @deprecated use  jsonrpcReservedErrorRangeEnd */
57     const serverErrorEnd: number;
58 }
59 export interface ResponseErrorLiteral<D> {
60     /**
61      * A number indicating the error type that occured.
62      */
63     code: number;
64     /**
65      * A string providing a short decription of the error.
66      */
67     message: string;
68     /**
69      * A Primitive or Structured value that contains additional
70      * information about the error. Can be omitted.
71      */
72     data?: D;
73 }
74 /**
75  * An error object return in a response in case a request
76  * has failed.
77  */
78 export declare class ResponseError<D> extends Error {
79     readonly code: number;
80     readonly data: D | undefined;
81     constructor(code: number, message: string, data?: D);
82     toJson(): ResponseErrorLiteral<D>;
83 }
84 /**
85  * A response message.
86  */
87 export interface ResponseMessage extends Message {
88     /**
89      * The request id.
90      */
91     id: number | string | null;
92     /**
93      * The result of a request. This member is REQUIRED on success.
94      * This member MUST NOT exist if there was an error invoking the method.
95      */
96     result?: string | number | boolean | object | any[] | null;
97     /**
98      * The error object in case a request fails.
99      */
100     error?: ResponseErrorLiteral<any>;
101 }
102 /**
103  * A LSP Log Entry.
104  */
105 export declare type LSPMessageType = 'send-request' | 'receive-request' | 'send-response' | 'receive-response' | 'send-notification' | 'receive-notification';
106 export interface LSPLogMessage {
107     type: LSPMessageType;
108     message: RequestMessage | ResponseMessage | NotificationMessage;
109     timestamp: number;
110 }
111 export declare class ParameterStructures {
112     private readonly kind;
113     /**
114      * The parameter structure is automatically inferred on the number of parameters
115      * and the parameter type in case of a single param.
116      */
117     static readonly auto: ParameterStructures;
118     /**
119      * Forces `byPosition` parameter structure. This is useful if you have a single
120      * parameter which has a literal type.
121      */
122     static readonly byPosition: ParameterStructures;
123     /**
124      * Forces `byName` parameter structure. This is only useful when having a single
125      * parameter. The library will report errors if used with a different number of
126      * parameters.
127      */
128     static readonly byName: ParameterStructures;
129     private constructor();
130     static is(value: any): value is ParameterStructures;
131     toString(): string;
132 }
133 /**
134  * An interface to type messages.
135  */
136 export interface MessageSignature {
137     readonly method: string;
138     readonly numberOfParams: number;
139     readonly parameterStructures: ParameterStructures;
140 }
141 /**
142  * An abstract implementation of a MessageType.
143  */
144 export declare abstract class AbstractMessageSignature implements MessageSignature {
145     readonly method: string;
146     readonly numberOfParams: number;
147     constructor(method: string, numberOfParams: number);
148     get parameterStructures(): ParameterStructures;
149 }
150 /**
151  * End marker interface for request and notification types.
152  */
153 export interface _EM {
154     _$endMarker$_: number;
155 }
156 /**
157  * Classes to type request response pairs
158  */
159 export declare class RequestType0<R, E> extends AbstractMessageSignature {
160     /**
161      * Clients must not use this property. It is here to ensure correct typing.
162      */
163     readonly _: [R, E, _EM] | undefined;
164     constructor(method: string);
165 }
166 export declare class RequestType<P, R, E> extends AbstractMessageSignature {
167     private _parameterStructures;
168     /**
169      * Clients must not use this property. It is here to ensure correct typing.
170      */
171     readonly _: [P, R, E, _EM] | undefined;
172     constructor(method: string, _parameterStructures?: ParameterStructures);
173     get parameterStructures(): ParameterStructures;
174 }
175 export declare class RequestType1<P1, R, E> extends AbstractMessageSignature {
176     private _parameterStructures;
177     /**
178      * Clients must not use this property. It is here to ensure correct typing.
179      */
180     readonly _: [P1, R, E, _EM] | undefined;
181     constructor(method: string, _parameterStructures?: ParameterStructures);
182     get parameterStructures(): ParameterStructures;
183 }
184 export declare class RequestType2<P1, P2, R, E> extends AbstractMessageSignature {
185     /**
186      * Clients must not use this property. It is here to ensure correct typing.
187      */
188     readonly _: [P1, P2, R, E, _EM] | undefined;
189     constructor(method: string);
190 }
191 export declare class RequestType3<P1, P2, P3, R, E> extends AbstractMessageSignature {
192     /**
193      * Clients must not use this property. It is here to ensure correct typing.
194      */
195     readonly _: [P1, P2, P3, R, E, _EM] | undefined;
196     constructor(method: string);
197 }
198 export declare class RequestType4<P1, P2, P3, P4, R, E> extends AbstractMessageSignature {
199     /**
200      * Clients must not use this property. It is here to ensure correct typing.
201      */
202     readonly _: [P1, P2, P3, P4, R, E, _EM] | undefined;
203     constructor(method: string);
204 }
205 export declare class RequestType5<P1, P2, P3, P4, P5, R, E> extends AbstractMessageSignature {
206     /**
207      * Clients must not use this property. It is here to ensure correct typing.
208      */
209     readonly _: [P1, P2, P3, P4, P5, R, E, _EM] | undefined;
210     constructor(method: string);
211 }
212 export declare class RequestType6<P1, P2, P3, P4, P5, P6, R, E> extends AbstractMessageSignature {
213     /**
214      * Clients must not use this property. It is here to ensure correct typing.
215      */
216     readonly _: [P1, P2, P3, P4, P5, P6, R, E, _EM] | undefined;
217     constructor(method: string);
218 }
219 export declare class RequestType7<P1, P2, P3, P4, P5, P6, P7, R, E> extends AbstractMessageSignature {
220     /**
221      * Clients must not use this property. It is here to ensure correct typing.
222      */
223     readonly _: [P1, P2, P3, P4, P5, P6, P7, R, E, _EM] | undefined;
224     constructor(method: string);
225 }
226 export declare class RequestType8<P1, P2, P3, P4, P5, P6, P7, P8, R, E> extends AbstractMessageSignature {
227     /**
228      * Clients must not use this property. It is here to ensure correct typing.
229      */
230     readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, R, E, _EM] | undefined;
231     constructor(method: string);
232 }
233 export declare class RequestType9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E> extends AbstractMessageSignature {
234     /**
235      * Clients must not use this property. It is here to ensure correct typing.
236      */
237     readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E, _EM] | undefined;
238     constructor(method: string);
239 }
240 /**
241  * Notification Message
242  */
243 export interface NotificationMessage extends Message {
244     /**
245      * The method to be invoked.
246      */
247     method: string;
248     /**
249      * The notification's params.
250      */
251     params?: [] | object;
252 }
253 export declare class NotificationType<P> extends AbstractMessageSignature {
254     private _parameterStructures;
255     /**
256      * Clients must not use this property. It is here to ensure correct typing.
257      */
258     readonly _: [P, _EM] | undefined;
259     constructor(method: string, _parameterStructures?: ParameterStructures);
260     get parameterStructures(): ParameterStructures;
261 }
262 export declare class NotificationType0 extends AbstractMessageSignature {
263     /**
264      * Clients must not use this property. It is here to ensure correct typing.
265      */
266     readonly _: [_EM] | undefined;
267     constructor(method: string);
268 }
269 export declare class NotificationType1<P1> extends AbstractMessageSignature {
270     private _parameterStructures;
271     /**
272      * Clients must not use this property. It is here to ensure correct typing.
273      */
274     readonly _: [P1, _EM] | undefined;
275     constructor(method: string, _parameterStructures?: ParameterStructures);
276     get parameterStructures(): ParameterStructures;
277 }
278 export declare class NotificationType2<P1, P2> extends AbstractMessageSignature {
279     /**
280      * Clients must not use this property. It is here to ensure correct typing.
281      */
282     readonly _: [P1, P2, _EM] | undefined;
283     constructor(method: string);
284 }
285 export declare class NotificationType3<P1, P2, P3> extends AbstractMessageSignature {
286     /**
287      * Clients must not use this property. It is here to ensure correct typing.
288      */
289     readonly _: [P1, P2, P3, _EM] | undefined;
290     constructor(method: string);
291 }
292 export declare class NotificationType4<P1, P2, P3, P4> extends AbstractMessageSignature {
293     /**
294      * Clients must not use this property. It is here to ensure correct typing.
295      */
296     readonly _: [P1, P2, P3, P4, _EM] | undefined;
297     constructor(method: string);
298 }
299 export declare class NotificationType5<P1, P2, P3, P4, P5> extends AbstractMessageSignature {
300     /**
301      * Clients must not use this property. It is here to ensure correct typing.
302      */
303     readonly _: [P1, P2, P3, P4, P5, _EM] | undefined;
304     constructor(method: string);
305 }
306 export declare class NotificationType6<P1, P2, P3, P4, P5, P6> extends AbstractMessageSignature {
307     /**
308      * Clients must not use this property. It is here to ensure correct typing.
309      */
310     readonly _: [P1, P2, P3, P4, P5, P6, _EM] | undefined;
311     constructor(method: string);
312 }
313 export declare class NotificationType7<P1, P2, P3, P4, P5, P6, P7> extends AbstractMessageSignature {
314     /**
315      * Clients must not use this property. It is here to ensure correct typing.
316      */
317     readonly _: [P1, P2, P3, P4, P5, P6, P7, _EM] | undefined;
318     constructor(method: string);
319 }
320 export declare class NotificationType8<P1, P2, P3, P4, P5, P6, P7, P8> extends AbstractMessageSignature {
321     /**
322      * Clients must not use this property. It is here to ensure correct typing.
323      */
324     readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, _EM] | undefined;
325     constructor(method: string);
326 }
327 export declare class NotificationType9<P1, P2, P3, P4, P5, P6, P7, P8, P9> extends AbstractMessageSignature {
328     /**
329      * Clients must not use this property. It is here to ensure correct typing.
330      */
331     readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, P9, _EM] | undefined;
332     constructor(method: string);
333 }
334 /**
335  * Tests if the given message is a request message
336  */
337 export declare function isRequestMessage(message: Message | undefined): message is RequestMessage;
338 /**
339  * Tests if the given message is a notification message
340  */
341 export declare function isNotificationMessage(message: Message | undefined): message is NotificationMessage;
342 /**
343  * Tests if the given message is a response message
344  */
345 export declare function isResponseMessage(message: Message | undefined): message is ResponseMessage;