-
Notifications
You must be signed in to change notification settings - Fork 328
/
proposed.diagnostic.ts
378 lines (334 loc) · 10.4 KB
/
proposed.diagnostic.ts
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { RequestHandler0, RequestHandler, ProgressType } from 'vscode-jsonrpc';
import { TextDocumentIdentifier, Diagnostic, DocumentUri, integer } from 'vscode-languageserver-types';
import * as Is from './utils/is';
import { ProtocolRequestType0, ProtocolRequestType } from './messages';
import {
PartialResultParams, StaticRegistrationOptions, WorkDoneProgressParams, TextDocumentRegistrationOptions, WorkDoneProgressOptions, TextDocumentClientCapabilities
} from './protocol';
/**
* @since 3.17.0 - proposed state
*/
export interface DiagnosticClientCapabilities {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
/**
* Whether the clients supports related documents for document diagnostic pulls.
*/
relatedDocumentSupport?: boolean;
}
export interface $DiagnosticClientCapabilities {
textDocument?: TextDocumentClientCapabilities & {
diagnostic?: DiagnosticClientCapabilities;
}
}
/**
* Diagnostic options.
*
* @since 3.17.0 - proposed state
*/
export interface DiagnosticOptions extends WorkDoneProgressOptions {
/**
* An optional identifier under which the diagnostics are
* managed by the client.
*/
identifier?: string;
/**
* Whether the language has inter file dependencies meaning that
* editing code in one file can result in a different diagnostic
* set in another file. Inter file dependencies are common for
* most programming languages and typically uncommon for linters.
*/
interFileDependencies: boolean;
/**
* The server provides support for workspace diagnostics as well.
*/
workspaceDiagnostics: boolean;
}
/**
* Diagnostic registration options.
*
* @since 3.17.0 - proposed state
*/
export interface DiagnosticRegistrationOptions extends TextDocumentRegistrationOptions, DiagnosticOptions, StaticRegistrationOptions {
}
export interface $DiagnosticServerCapabilities {
diagnosticProvider?: DiagnosticOptions;
}
/**
* Cancellation data returned from a diagnostic request.
*
* @since 3.17.0 - proposed state
*/
export interface DiagnosticServerCancellationData {
retriggerRequest: boolean;
}
/**
* @since 3.17.0 - proposed state
*/
export namespace DiagnosticServerCancellationData {
export function is(value: any): value is DiagnosticServerCancellationData {
const candidate = value as DiagnosticServerCancellationData;
return candidate && Is.boolean(candidate.retriggerRequest);
}
}
/**
* Parameters of the document diagnostic request.
*
* @since 3.17.0 - proposed state
*/
export interface DocumentDiagnosticParams extends WorkDoneProgressParams, PartialResultParams {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
/**
* The additional identifier provided during registration.
*/
identifier?: string;
/**
* The result id of a previous response if provided.
*/
previousResultId?: string;
}
/**
* The document diagnostic report kinds.
*
* @since 3.17.0 - proposed state
*/
export enum DocumentDiagnosticReportKind {
/**
* A diagnostic report with a full
* set of problems.
*/
full = 'full',
/**
* A report indicating that the last
* returned report is still accurate.
*/
unChanged = 'unChanged'
}
/**
* A diagnostic report with a full set of problems.
*
* @since 3.17.0 - proposed state
*/
export interface FullDocumentDiagnosticReport {
/**
* A full document diagnostic report.
*/
kind: DocumentDiagnosticReportKind.full;
/**
* An optional result id. If provided it will
* be sent on the next diagnostic request for the
* same document.
*/
resultId?: string;
/**
* The actual items.
*/
items: Diagnostic[];
}
/**
* A full diagnostic report with a set of related documents.
*
* @since 3.17.0 - proposed state
*/
export interface RelatedFullDocumentDiagnosticReport extends FullDocumentDiagnosticReport {
/**
* Diagnostics of related documents. This information is useful
* in programming languages where code in a file A can generate
* diagnostics in a file B which A depends on. An example of
* such a language is C/C++ where marco definitions in a file
* a.cpp and result in errors in a header file b.hpp.
*
* @since 3.17.0 - proposed state
*/
relatedDocuments?: {
[uri: string /** DocumentUri */]: FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport;
}
}
/**
* A diagnostic report indicating that the last returned
* report is still accurate.
*
* @since 3.17.0 - proposed state
*/
export interface UnchangedDocumentDiagnosticReport {
/**
* A document diagnostic report indicating
* no changes to the last result. A server can
* only return `unchanged` if result ids are
* provided.
*/
kind: DocumentDiagnosticReportKind.unChanged;
/**
* A result id which will be sent on the next
* diagnostic request for the same document.
*/
resultId: string;
}
/**
* An unchanged diagnostic report with a set of related documents.
*
* @since 3.17.0 - proposed state
*/
export interface RelatedUnchangedDocumentDiagnosticReport extends UnchangedDocumentDiagnosticReport {
/**
* Diagnostics of related documents. This information is useful
* in programming languages where code in a file A can generate
* diagnostics in a file B which A depends on. An example of
* such a language is C/C++ where marco definitions in a file
* a.cpp and result in errors in a header file b.hpp.
*
* @since 3.17.0 - proposed state
*/
relatedDocuments?: {
[uri: string /** DocumentUri */]: FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport;
}
}
/**
* The result of a document diagnostic pull request. A report can
* either be a full report containing all diagnostics for the
* requested document or a unchanged report indicating that nothing
* has changed in terms of diagnostics in comparison to the last
* pull request.
*
* @since 3.17.0 - proposed state
*/
export type DocumentDiagnosticReport = RelatedFullDocumentDiagnosticReport | RelatedUnchangedDocumentDiagnosticReport;
/**
* A partial result for a document diagnostic report.
*
* @since 3.17.0 - proposed state
*/
export interface DocumentDiagnosticReportPartialResult {
relatedDocuments: {
[uri: string /** DocumentUri */]: FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport;
}
}
/**
* The document diagnostic request definition.
*
* @since 3.17.0 - proposed state
*/
export namespace DocumentDiagnosticRequest {
export const method: 'textDocument/diagnostic' = 'textDocument/diagnostic';
export const type = new ProtocolRequestType<DocumentDiagnosticParams, DocumentDiagnosticReport, DocumentDiagnosticReportPartialResult, DiagnosticServerCancellationData, DiagnosticRegistrationOptions>(method);
export const partialResult = new ProgressType<DocumentDiagnosticReportPartialResult>();
export type HandlerSignature = RequestHandler<DocumentDiagnosticParams, DocumentDiagnosticReport, void>;
}
/**
* A previous result id in a workspace pull request.
*
* @since 3.17.0 - proposed state
*/
export type PreviousResultId = {
/**
* The URI for which the client knowns a
* result id.
*/
uri: DocumentUri;
/**
* The value of the previous result id.
*/
value: string;
};
/**
* Parameters of the workspace diagnostic request.
*
* @since 3.17.0 - proposed state
*/
export interface WorkspaceDiagnosticParams extends WorkDoneProgressParams, PartialResultParams {
/**
* The additional identifier provided during registration.
*/
identifier?: string;
/**
* The currently known diagnostic reports with their
* previous result ids.
*/
previousResultIds: PreviousResultId[];
}
/**
* A full document diagnostic report for a workspace diagnostic result.
*
* @since 3.17.0 - proposed state
*/
export interface WorkspaceFullDocumentDiagnosticReport extends FullDocumentDiagnosticReport {
/**
* The URI for which diagnostic information is reported.
*/
uri: DocumentUri;
/**
* The version number for which the diagnostics are reported.
* If the document is not marked as open `null` can be provided.
*/
version: integer | null;
}
/**
* An unchanged document diagnostic report for a workspace diagnostic result.
*
* @since 3.17.0 - proposed state
*/
export interface WorkspaceUnchangedDocumentDiagnosticReport extends UnchangedDocumentDiagnosticReport {
/**
* The URI for which diagnostic information is reported.
*/
uri: DocumentUri;
/**
* The version number for which the diagnostics are reported.
* If the document is not marked as open `null` can be provided.
*/
version: integer | null;
}
/**
* A workspace diagnostic document report.
*
* @since 3.17.0 - proposed state
*/
export type WorkspaceDocumentDiagnosticReport = WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport;
/**
* A workspace diagnostic report.
*
* @since 3.17.0 - proposed state
*/
export interface WorkspaceDiagnosticReport {
items: WorkspaceDocumentDiagnosticReport[];
}
/**
* A partial result for a workspace diagnostic report.
*
* @since 3.17.0 - proposed state
*/
export interface WorkspaceDiagnosticReportPartialResult {
items: WorkspaceDocumentDiagnosticReport[];
}
/**
* The workspace diagnostic request definition.
*
* @since 3.17.0 - proposed state
*/
export namespace WorkspaceDiagnosticRequest {
export const method: 'workspace/diagnostic' = 'workspace/diagnostic';
export const type = new ProtocolRequestType<WorkspaceDiagnosticParams, WorkspaceDiagnosticReport, WorkspaceDiagnosticReportPartialResult, DiagnosticServerCancellationData, void>(method);
export const partialResult = new ProgressType<WorkspaceDiagnosticReportPartialResult>();
export type HandlerSignature = RequestHandler<WorkspaceDiagnosticParams, WorkspaceDiagnosticReport | null, void>;
}
/**
* The diagnostic refresh request definition.
*
* @since 3.17.0 - proposed state
*/
export namespace DiagnosticRefreshRequest {
export const method: `workspace/diagnostic/refresh` = `workspace/diagnostic/refresh`;
export const type = new ProtocolRequestType0<void, void, void, void>(method);
export type HandlerSignature = RequestHandler0<void, void>;
}