forked from redhat-developer/vscode-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotocol.ts
More file actions
506 lines (417 loc) · 12.6 KB
/
protocol.ts
File metadata and controls
506 lines (417 loc) · 12.6 KB
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
'use strict';
import { Command, Range } from 'vscode';
import {
CodeActionParams,
ExecuteCommandParams,
FormattingOptions,
Location,
NotificationType,
RequestType,
SymbolInformation,
TextDocumentIdentifier,
TextDocumentPositionParams,
WorkspaceEdit,
WorkspaceSymbolParams,
} from 'vscode-languageclient';
/**
* The message type. Copied from vscode protocol
*/
export enum MessageType {
/**
* An error message.
*/
error = 1,
/**
* A warning message.
*/
warning = 2,
/**
* An information message.
*/
info = 3,
/**
* A log message.
*/
log = 4,
}
/**
* A functionality status
*/
export enum FeatureStatus {
/**
* Disabled.
*/
disabled = 0,
/**
* Enabled manually.
*/
interactive = 1,
/**
* Enabled automatically.
*/
automatic = 2,
}
export enum EventType {
classpathUpdated = 100,
projectsImported = 200,
projectsDeleted = 210,
incompatibleGradleJdkIssue = 300,
upgradeGradleWrapper = 400,
sourceInvalidated = 500,
}
export enum CompileWorkspaceStatus {
failed = 0,
succeed = 1,
withError = 2,
cancelled = 3,
}
export enum AccessorKind {
getter = 0,
setter = 1,
both = 2
}
export interface StatusReport {
message: string;
type: string;
}
export interface ProgressReport {
token: string;
value: any;
complete: boolean;
}
export enum ProgressKind {
begin = "begin",
report = "report",
end = "end"
}
export interface ActionableMessage {
severity: MessageType;
message: string;
data?: any;
commands?: Command[];
}
export interface EventNotification {
eventType: EventType;
data?: any;
}
export namespace StatusNotification {
export const type = new NotificationType<StatusReport>('language/status');
}
// See https://github.com/microsoft/vscode-languageserver-node/blob/release/client/8.1.0/jsonrpc/src/common/connection.ts#L53-L55
export namespace ProgressNotification {
export const type = new NotificationType<ProgressReport>('$/progress');
}
export namespace ClassFileContentsRequest {
export const type = new RequestType<TextDocumentIdentifier, string, void> ('java/classFileContents');
}
export namespace ProjectConfigurationUpdateRequest {
export const type = new NotificationType<TextDocumentIdentifier> ('java/projectConfigurationUpdate');
export const typeV2 = new NotificationType<ProjectConfigurationsUpdateParam> ('java/projectConfigurationsUpdate');
}
export interface ProjectConfigurationsUpdateParam {
identifiers: TextDocumentIdentifier[];
}
export namespace ActionableNotification {
export const type = new NotificationType<ActionableMessage>('language/actionableNotification');
}
export namespace EventNotification {
export const type = new NotificationType<EventNotification>('language/eventNotification');
}
export namespace CompileWorkspaceRequest {
export const type = new RequestType<boolean, CompileWorkspaceStatus, void>('java/buildWorkspace');
}
export namespace BuildProjectRequest {
export const type = new RequestType<BuildProjectParams, CompileWorkspaceStatus, void>('java/buildProjects');
}
export interface BuildProjectParams {
identifiers: TextDocumentIdentifier[];
isFullBuild: boolean;
}
export namespace ExecuteClientCommandRequest {
export const type = new RequestType<ExecuteCommandParams, any, void>('workspace/executeClientCommand');
}
export namespace ServerNotification {
export const type = new NotificationType<ExecuteCommandParams>('workspace/notify');
}
export interface SourceAttachmentRequest {
classFileUri: string;
attributes?: SourceAttachmentAttribute;
}
export interface SourceAttachmentResult {
errorMessage?: string;
attributes?: SourceAttachmentAttribute;
}
export interface SourceAttachmentAttribute {
jarPath?: string;
sourceAttachmentPath?: string;
sourceAttachmentEncoding?: string;
canEditEncoding?: boolean;
}
export interface OverridableMethod {
key: string;
name: string;
parameters: string[];
unimplemented: boolean;
declaringClass: string;
declaringClassType: string;
}
export interface OverridableMethodsResponse {
type: string;
methods: OverridableMethod[];
}
export namespace ListOverridableMethodsRequest {
export const type = new RequestType<CodeActionParams, OverridableMethodsResponse, void>('java/listOverridableMethods');
}
export interface AddOverridableMethodParams {
context: CodeActionParams;
overridableMethods: OverridableMethod[];
}
export namespace AddOverridableMethodsRequest {
export const type = new RequestType<AddOverridableMethodParams, WorkspaceEdit, void>('java/addOverridableMethods');
}
export interface VariableBinding {
bindingKey: string;
name: string;
type: string;
isField: boolean;
isSelected?: boolean;
}
export interface CheckHashCodeEqualsResponse {
type: string;
fields: VariableBinding[];
existingMethods: string[];
}
export namespace CheckHashCodeEqualsStatusRequest {
export const type = new RequestType<CodeActionParams, CheckHashCodeEqualsResponse, void>('java/checkHashCodeEqualsStatus');
}
export interface GenerateHashCodeEqualsParams {
context: CodeActionParams;
fields: VariableBinding[];
regenerate: boolean;
}
export namespace GenerateHashCodeEqualsRequest {
export const type = new RequestType<GenerateHashCodeEqualsParams, WorkspaceEdit, void>('java/generateHashCodeEquals');
}
export namespace OrganizeImportsRequest {
export const type = new RequestType<CodeActionParams, WorkspaceEdit, void>('java/organizeImports');
}
export namespace CleanupRequest {
export const type = new RequestType<TextDocumentIdentifier, WorkspaceEdit, void>('java/cleanup');
}
export interface ImportCandidate {
fullyQualifiedName: string;
id: string;
}
export interface ImportSelection {
candidates: ImportCandidate[];
range: Range;
}
export interface CheckToStringResponse {
type: string;
fields: VariableBinding[];
exists: boolean;
}
export namespace CheckToStringStatusRequest {
export const type = new RequestType<CodeActionParams, CheckToStringResponse, void>('java/checkToStringStatus');
}
export interface GenerateToStringParams {
context: CodeActionParams;
fields: VariableBinding[];
}
export namespace GenerateToStringRequest {
export const type = new RequestType<GenerateToStringParams, WorkspaceEdit, void>('java/generateToString');
}
export interface AccessorField {
fieldName: string;
isStatic: boolean;
generateGetter: boolean;
generateSetter: boolean;
typeName: string;
}
export interface AccessorCodeActionParams extends CodeActionParams {
kind: AccessorKind;
}
export namespace AccessorCodeActionRequest {
export const type = new RequestType<AccessorCodeActionParams, AccessorField[], void>('java/resolveUnimplementedAccessors');
}
export interface GenerateAccessorsParams {
context: CodeActionParams;
accessors: AccessorField[];
}
export namespace GenerateAccessorsRequest {
export const type = new RequestType<GenerateAccessorsParams, WorkspaceEdit, void>('java/generateAccessors');
}
export interface MethodBinding {
bindingKey: string;
name: string;
parameters: string[];
}
export interface CheckConstructorsResponse {
constructors: MethodBinding[];
fields: VariableBinding[];
}
export namespace CheckConstructorStatusRequest {
export const type = new RequestType<CodeActionParams, CheckConstructorsResponse, void>('java/checkConstructorsStatus');
}
export interface GenerateConstructorsParams {
context: CodeActionParams;
constructors: MethodBinding[];
fields: VariableBinding[];
}
export namespace GenerateConstructorsRequest {
export const type = new RequestType<GenerateConstructorsParams, WorkspaceEdit, void>('java/generateConstructors');
}
export interface DelegateField {
field: VariableBinding;
delegateMethods: MethodBinding[];
}
export interface CheckDelegateMethodsResponse {
delegateFields: DelegateField[];
}
export namespace CheckDelegateMethodsStatusRequest {
export const type = new RequestType<CodeActionParams, CheckDelegateMethodsResponse, void>('java/checkDelegateMethodsStatus');
}
export interface DelegateEntry {
field: VariableBinding;
delegateMethod: MethodBinding;
}
export interface GenerateDelegateMethodsParams {
context: CodeActionParams;
delegateEntries: DelegateEntry[];
}
export namespace GenerateDelegateMethodsRequest {
export const type = new RequestType<GenerateDelegateMethodsParams, WorkspaceEdit, void>('java/generateDelegateMethods');
}
export interface RenamePosition {
uri: string;
offset: number;
length: number;
}
export interface RefactorWorkspaceEdit {
edit: WorkspaceEdit;
command?: Command;
errorMessage?: string;
}
export interface GetRefactorEditParams {
command: string;
context: CodeActionParams;
options: FormattingOptions;
commandArguments: any[];
}
export namespace GetRefactorEditRequest {
export const type = new RequestType<GetRefactorEditParams, RefactorWorkspaceEdit, void>('java/getRefactorEdit');
}
export namespace GetChangeSignatureInfoRequest {
export const type = new RequestType<CodeActionParams, ChangeSignatureInfo, void>('java/getChangeSignatureInfo');
}
export interface SelectionInfo {
name: string;
length: number;
offset: number;
params?: string[];
}
export interface ChangeSignatureInfo {
methodIdentifier: string;
modifier: string;
returnType: string;
methodName: string;
parameters: any;
exceptions: any;
errorMessage: string;
}
export interface InferSelectionParams {
command: string;
context: CodeActionParams;
}
export namespace InferSelectionRequest {
export const type = new RequestType<InferSelectionParams, SelectionInfo[], void>('java/inferSelection');
}
export interface PackageNode {
displayName: string;
uri: string;
path: string;
project: string;
isDefaultPackage: boolean;
isParentOfSelectedFile: boolean;
}
export interface MoveParams {
moveKind: string;
sourceUris: string[];
params: CodeActionParams;
destination?: any;
updateReferences?: boolean;
}
export interface MoveDestinationsResponse {
errorMessage?: string;
destinations: any[];
}
export namespace GetMoveDestinationsRequest {
export const type = new RequestType<MoveParams, MoveDestinationsResponse, void>('java/getMoveDestinations');
}
export namespace MoveRequest {
export const type = new RequestType<MoveParams, RefactorWorkspaceEdit, void>('java/move');
}
export interface SearchSymbolParams extends WorkspaceSymbolParams {
projectName: string;
maxResults?: number;
sourceOnly?: boolean;
}
export namespace SearchSymbols {
export const type = new RequestType<SearchSymbolParams, SymbolInformation[], void>('java/searchSymbols');
}
export interface FindLinksParams {
type: string;
position: TextDocumentPositionParams;
}
export interface LinkLocation extends Location {
displayName: string;
kind: string;
}
export namespace FindLinks {
export const type = new RequestType<FindLinksParams, LinkLocation[], void>('java/findLinks');
}
export interface RenameFilesParams {
files: Array<{ oldUri: string; newUri: string }>;
}
export namespace WillRenameFiles {
export const type = new RequestType<RenameFilesParams, WorkspaceEdit, void>('workspace/willRenameFiles');
}
export interface GradleCompatibilityInfo {
projectUri: string;
message: string;
highestJavaVersion: string;
recommendedGradleVersion: string;
}
export interface UpgradeGradleWrapperInfo {
projectUri: string;
message: string;
recommendedGradleVersion: string;
}
export interface Member {
name: string;
typeName: string;
parameters: string[];
handleIdentifier: string;
}
export interface CheckExtractInterfaceStatusResponse {
members: Member[];
subTypeName: string;
destinationResponse: MoveDestinationsResponse;
}
export namespace CheckExtractInterfaceStatusRequest {
export const type = new RequestType<CodeActionParams, CheckExtractInterfaceStatusResponse, void>('java/checkExtractInterfaceStatus');
}
export interface ValidateDocumentParams {
textDocument: TextDocumentIdentifier;
}
export namespace ValidateDocumentNotification {
export const type = new NotificationType<ValidateDocumentParams>('java/validateDocument');
}
export interface SourceInvalidatedEvent {
/**
* The package fragment roots that get new source attachments.
* The key is its root path, the value means if its source is
* automatically downloaded.
*/
affectedRootPaths: { [key: string]: boolean };
}