@codingame/monaco-languageclient-wrapper 3.2.0 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/java.js CHANGED
@@ -1,59 +1,38 @@
1
1
  import { EventEmitter, InlayHint, InlayHintKind, workspace, commands, window, TextEditorRevealType, Uri, ViewColumn, languages } from 'vscode';
2
2
  import { a as api, m as main } from './index2.js';
3
3
  import { E as ExtensionFeature } from './tools.js';
4
-
5
- /******************************************************************************
6
- Copyright (c) Microsoft Corporation.
7
-
8
- Permission to use, copy, modify, and/or distribute this software for any
9
- purpose with or without fee is hereby granted.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
- PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */
19
-
20
- function __awaiter(thisArg, _arguments, P, generator) {
21
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22
- return new (P || (P = Promise))(function (resolve, reject) {
23
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
26
- step((generator = generator.apply(thisArg, _arguments || [])).next());
27
- });
4
+ function __awaiter(thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
28
12
  }
29
-
30
13
  class JavaInlayHintsProvider {
31
14
  constructor(client) {
32
15
  this.client = client;
33
- this.onDidChange = /*#__PURE__*/ new EventEmitter();
16
+ this.onDidChange = new EventEmitter();
34
17
  this.onDidChangeInlayHints = this.onDidChange.event;
35
- this.client.onRequest(InlayHintRefreshRequest.type, () => /*#__PURE__*/ __awaiter(this, void 0, void 0, function* () {
18
+ this.client.onRequest(InlayHintRefreshRequest.type, () => __awaiter(this, void 0, void 0, function* () {
36
19
  this.onDidChange.fire();
37
20
  }));
38
21
  }
39
-
40
22
  provideInlayHints(document, range, token) {
41
23
  return (
42
- /*#__PURE__*/ __awaiter(this, void 0, void 0, function* () {
24
+ __awaiter(this, void 0, void 0, function* () {
43
25
  const requestParams = {
44
26
  textDocument: this.client.code2ProtocolConverter.asTextDocumentIdentifier(document),
45
27
  range: this.client.code2ProtocolConverter.asRange(range)
46
28
  };
47
-
48
29
  try {
49
30
  const values = yield this.client.sendRequest(InlayHintRequest.type, requestParams, token);
50
-
51
31
  if (token.isCancellationRequested) {
52
32
  return [];
53
33
  }
54
-
55
34
  return (
56
- /*#__PURE__*/ asInlayHints(values, this.client)
35
+ asInlayHints(values, this.client)
57
36
  );
58
37
  } catch (error) {
59
38
  return this.client.handleFailedRequest(InlayHintRequest.type, token, error, []);
@@ -61,34 +40,23 @@ class JavaInlayHintsProvider {
61
40
  })
62
41
  );
63
42
  }
64
-
65
43
  }
66
44
  var InlayHintRequest;
67
-
68
- /*#__PURE__*/ (function(InlayHintRequest) {
69
- InlayHintRequest.type = /*#__PURE__*/ new api.RequestType('textDocument/inlayHint');
45
+ (function(InlayHintRequest) {
46
+ InlayHintRequest.type = new api.RequestType('textDocument/inlayHint');
70
47
  })(InlayHintRequest || (InlayHintRequest = {}));
71
- /**
72
- * @since 3.17.0 - proposed state
73
- */
74
-
75
-
76
48
  var InlayHintRefreshRequest;
77
-
78
- /*#__PURE__*/ (function(InlayHintRefreshRequest) {
79
- InlayHintRefreshRequest.type = /*#__PURE__*/ new api.RequestType('workspace/inlayHint/refresh');
49
+ (function(InlayHintRefreshRequest) {
50
+ InlayHintRefreshRequest.type = new api.RequestType('workspace/inlayHint/refresh');
80
51
  })(InlayHintRefreshRequest || (InlayHintRefreshRequest = {}));
81
-
82
52
  function asInlayHints(values, client) {
83
53
  return __awaiter(this, void 0, void 0, function* () {
84
54
  if (!Array.isArray(values)) {
85
55
  return undefined;
86
56
  }
87
-
88
57
  return values.map(lsHint => asInlayHint(lsHint, client));
89
58
  });
90
59
  }
91
-
92
60
  function asInlayHint(value, client) {
93
61
  const label = value.label;
94
62
  const result = new InlayHint(client.protocol2CodeConverter.asPosition(value.position), label);
@@ -96,302 +64,68 @@ function asInlayHint(value, client) {
96
64
  result.kind = InlayHintKind.Parameter;
97
65
  return result;
98
66
  }
99
-
100
- /**
101
- * Commonly used commands
102
- */
103
-
104
67
  var Commands;
105
-
106
- /*#__PURE__*/ (function(Commands) {
107
- /**
108
- * Open Browser
109
- */
68
+ (function(Commands) {
110
69
  Commands.OPEN_BROWSER = 'vscode.open';
111
- /**
112
- * Open Output view
113
- */
114
-
115
70
  Commands.OPEN_OUTPUT = 'java.open.output';
116
- /**
117
- * Show Java references
118
- */
119
-
120
71
  Commands.SHOW_JAVA_REFERENCES = 'java.show.references';
121
- /**
122
- * Show Java implementations
123
- */
124
-
125
72
  Commands.SHOW_JAVA_IMPLEMENTATIONS = 'java.show.implementations';
126
- /**
127
- * Show editor references
128
- */
129
-
130
73
  Commands.SHOW_REFERENCES = 'editor.action.showReferences';
131
- /**
132
- * Go to editor location
133
- */
134
-
135
74
  Commands.GOTO_LOCATION = 'editor.action.goToLocations';
136
- /**
137
- * Render markdown string to html string
138
- */
139
-
140
75
  Commands.MARKDOWN_API_RENDER = 'markdown.api.render';
141
- /**
142
- * Reload project
143
- */
144
-
145
76
  Commands.CONFIGURATION_UPDATE = 'java.projectConfiguration.update';
146
- /**
147
- * Ignore "Incomplete Classpath" messages
148
- */
149
-
150
77
  Commands.IGNORE_INCOMPLETE_CLASSPATH = 'java.ignoreIncompleteClasspath';
151
- /**
152
- * Open help for "Incomplete Classpath" message
153
- */
154
-
155
78
  Commands.IGNORE_INCOMPLETE_CLASSPATH_HELP = 'java.ignoreIncompleteClasspath.help';
156
- /**
157
- * Reload VS Code window
158
- */
159
-
160
79
  Commands.RELOAD_WINDOW = 'workbench.action.reloadWindow';
161
- /**
162
- * Set project configuration update mode
163
- */
164
-
165
80
  Commands.PROJECT_CONFIGURATION_STATUS = 'java.projectConfiguration.status';
166
- /**
167
- * Apply Workspace Edit
168
- */
169
-
170
81
  Commands.APPLY_WORKSPACE_EDIT = 'java.apply.workspaceEdit';
171
- /**
172
- * Execute Workspace Command
173
- */
174
-
175
82
  Commands.EXECUTE_WORKSPACE_COMMAND = 'java.execute.workspaceCommand';
176
- /**
177
- * Execute Workspace build (compilation)
178
- */
179
-
180
83
  Commands.COMPILE_WORKSPACE = 'java.workspace.compile';
181
- /**
182
- * Execute build for projects
183
- */
184
-
185
84
  Commands.BUILD_PROJECT = 'java.project.build';
186
- /**
187
- * Open Java Language Server Log file
188
- */
189
-
190
85
  Commands.OPEN_SERVER_LOG = 'java.open.serverLog';
191
- /**
192
- * Open Java Language Service Output Log file
193
- */
194
-
195
86
  Commands.OPEN_SERVER_STDOUT_LOG = 'java.open.serverStdoutLog';
196
- /**
197
- * Open Java Language Server Error Log file
198
- */
199
-
200
87
  Commands.OPEN_SERVER_STDERR_LOG = 'java.open.serverStderrLog';
201
- /**
202
- * Open Java client Log file
203
- */
204
-
205
88
  Commands.OPEN_CLIENT_LOG = 'java.open.clientLog';
206
- /**
207
- * Open Java log files side by side
208
- */
209
-
210
89
  Commands.OPEN_LOGS = 'java.open.logs';
211
- /**
212
- * Open Java formatter settings
213
- */
214
-
215
90
  Commands.OPEN_FORMATTER = 'java.open.formatter.settings';
216
- /**
217
- * Clean the Java language server workspace
218
- */
219
-
220
91
  Commands.CLEAN_WORKSPACE = 'java.clean.workspace';
221
- /**
222
- * Update the source attachment for the selected class file
223
- * client-side & server-side commands
224
- */
225
-
226
92
  Commands.UPDATE_SOURCE_ATTACHMENT_CMD = 'java.project.updateSourceAttachment.command';
227
93
  Commands.UPDATE_SOURCE_ATTACHMENT = 'java.project.updateSourceAttachment';
228
- /**
229
- * Resolve the source attachment information for the selected class file
230
- */
231
-
232
94
  Commands.RESOLVE_SOURCE_ATTACHMENT = 'java.project.resolveSourceAttachment';
233
- /**
234
- * Mark the folder as the source root of the closest project.
235
- * client-side & server-side commands
236
- */
237
-
238
95
  Commands.ADD_TO_SOURCEPATH_CMD = 'java.project.addToSourcePath.command';
239
96
  Commands.ADD_TO_SOURCEPATH = 'java.project.addToSourcePath';
240
- /**
241
- * Unmark the folder as the source root of the project.
242
- * client-side & server-side commands
243
- */
244
-
245
97
  Commands.REMOVE_FROM_SOURCEPATH_CMD = 'java.project.removeFromSourcePath.command';
246
98
  Commands.REMOVE_FROM_SOURCEPATH = 'java.project.removeFromSourcePath';
247
- /**
248
- * List all recognized source roots in the workspace.
249
- * client-side & server-side commands
250
- */
251
-
252
99
  Commands.LIST_SOURCEPATHS_CMD = 'java.project.listSourcePaths.command';
253
100
  Commands.LIST_SOURCEPATHS = 'java.project.listSourcePaths';
254
- /**
255
- * Import new projects
256
- * client-side & server-side commands
257
- */
258
-
259
101
  Commands.IMPORT_PROJECTS_CMD = 'java.project.import.command';
260
102
  Commands.IMPORT_PROJECTS = 'java.project.import';
261
- /**
262
- * Override or implements the methods from the supertypes.
263
- */
264
-
265
103
  Commands.OVERRIDE_METHODS_PROMPT = 'java.action.overrideMethodsPrompt';
266
- /**
267
- * Generate hashCode() and equals().
268
- */
269
-
270
104
  Commands.HASHCODE_EQUALS_PROMPT = 'java.action.hashCodeEqualsPrompt';
271
- /**
272
- * Open settings.json
273
- */
274
-
275
105
  Commands.OPEN_JSON_SETTINGS = 'workbench.action.openSettingsJson';
276
- /**
277
- * Organize imports.
278
- */
279
-
280
106
  Commands.ORGANIZE_IMPORTS = "java.action.organizeImports";
281
- /**
282
- * Organize imports silently.
283
- */
284
-
285
107
  Commands.ORGANIZE_IMPORTS_SILENTLY = "java.edit.organizeImports";
286
- /**
287
- * Custom paste action (triggers auto-import)
288
- */
289
-
290
108
  Commands.CLIPBOARD_ONPASTE = 'java.action.clipboardPasteAction';
291
- /**
292
- * Choose type to import.
293
- */
294
-
295
109
  Commands.CHOOSE_IMPORTS = "java.action.organizeImports.chooseImports";
296
- /**
297
- * Generate toString().
298
- */
299
-
300
110
  Commands.GENERATE_TOSTRING_PROMPT = 'java.action.generateToStringPrompt';
301
- /**
302
- * Generate Getters and Setters.
303
- */
304
-
305
111
  Commands.GENERATE_ACCESSORS_PROMPT = 'java.action.generateAccessorsPrompt';
306
- /**
307
- * Generate Constructors.
308
- */
309
-
310
112
  Commands.GENERATE_CONSTRUCTORS_PROMPT = 'java.action.generateConstructorsPrompt';
311
- /**
312
- * Generate Delegate Methods.
313
- */
314
-
315
113
  Commands.GENERATE_DELEGATE_METHODS_PROMPT = 'java.action.generateDelegateMethodsPrompt';
316
- /**
317
- * Apply Refactoring Command.
318
- */
319
-
320
114
  Commands.APPLY_REFACTORING_COMMAND = 'java.action.applyRefactoringCommand';
321
- /**
322
- * Rename Command.
323
- */
324
-
325
115
  Commands.RENAME_COMMAND = 'java.action.rename';
326
- /**
327
- * Navigate To Super Method Command.
328
- */
329
-
330
116
  Commands.NAVIGATE_TO_SUPER_IMPLEMENTATION_COMMAND = 'java.action.navigateToSuperImplementation';
331
- /**
332
- * Open Type Hierarchy of given Selection.
333
- */
334
-
335
117
  Commands.SHOW_TYPE_HIERARCHY = 'java.action.showTypeHierarchy';
336
- /**
337
- * Show SuperType Hierarchy of given Selection.
338
- */
339
-
340
118
  Commands.SHOW_SUPERTYPE_HIERARCHY = 'java.action.showSupertypeHierarchy';
341
- /**
342
- * Show SubType Hierarchy of given Selection.
343
- */
344
-
345
119
  Commands.SHOW_SUBTYPE_HIERARCHY = 'java.action.showSubtypeHierarchy';
346
- /**
347
- * Show Type Hierarchy of given Selection.
348
- */
349
-
350
120
  Commands.SHOW_CLASS_HIERARCHY = 'java.action.showClassHierarchy';
351
- /**
352
- * Change the base type of Type Hierarchy.
353
- */
354
-
355
121
  Commands.CHANGE_BASE_TYPE = 'java.action.changeBaseType';
356
- /**
357
- * Open the given TypeHierarchy Item.
358
- */
359
-
360
122
  Commands.OPEN_TYPE_HIERARCHY = 'java.navigate.openTypeHierarchy';
361
- /**
362
- * Resolve the given TypeHierarchy Item.
363
- */
364
-
365
123
  Commands.RESOLVE_TYPE_HIERARCHY = 'java.navigate.resolveTypeHierarchy';
366
- /**
367
- * Show server task status
368
- */
369
-
370
124
  Commands.SHOW_SERVER_TASK_STATUS = 'java.show.server.task.status';
371
- /**
372
- * Get the project settings
373
- */
374
-
375
125
  Commands.GET_PROJECT_SETTINGS = 'java.project.getSettings';
376
- /**
377
- * Get the classpaths and modulepaths
378
- */
379
-
380
126
  Commands.GET_CLASSPATHS = 'java.project.getClasspaths';
381
- /**
382
- * Check the input file is a test file or not
383
- */
384
-
385
127
  Commands.IS_TEST_FILE = 'java.project.isTestFile';
386
- /**
387
- * Get all java projects root path in URI format
388
- */
389
-
390
128
  Commands.GET_ALL_JAVA_PROJECTS = 'java.project.getAll';
391
- /**
392
- * Command to switch between standard mode and lightweight mode.
393
- */
394
-
395
129
  Commands.SWITCH_SERVER_MODE = 'java.server.mode.switch';
396
130
  Commands.LEARN_MORE_ABOUT_REFACTORING = '_java.learnMoreAboutRefactorings';
397
131
  Commands.TEMPLATE_VARIABLES = '_java.templateVariables';
@@ -403,115 +137,77 @@ var Commands;
403
137
  Commands.UPGRADE_GRADLE_WRAPPER = '_java.gradle.upgradeWrapper';
404
138
  Commands.LOMBOK_CONFIGURE = "java.lombokConfigure";
405
139
  })(Commands || (Commands = {}));
406
-
407
140
  var AccessorKind;
408
-
409
- /*#__PURE__*/ (function(AccessorKind) {
141
+ (function(AccessorKind) {
410
142
  AccessorKind[AccessorKind["GETTER"] = 0] = "GETTER";
411
143
  AccessorKind[AccessorKind["SETTER"] = 1] = "SETTER";
412
144
  AccessorKind[AccessorKind["BOTH"] = 2] = "BOTH";
413
145
  })(AccessorKind || (AccessorKind = {}));
414
-
415
146
  var ClassFileContentsRequest;
416
-
417
- /*#__PURE__*/ (function(ClassFileContentsRequest) {
418
- ClassFileContentsRequest.type = /*#__PURE__*/ new main.RequestType('java/classFileContents');
147
+ (function(ClassFileContentsRequest) {
148
+ ClassFileContentsRequest.type = new main.RequestType('java/classFileContents');
419
149
  })(ClassFileContentsRequest || (ClassFileContentsRequest = {}));
420
-
421
150
  var ListOverridableMethodsRequest;
422
-
423
- /*#__PURE__*/ (function(ListOverridableMethodsRequest) {
424
- ListOverridableMethodsRequest.type = /*#__PURE__*/ new main.RequestType('java/listOverridableMethods');
151
+ (function(ListOverridableMethodsRequest) {
152
+ ListOverridableMethodsRequest.type = new main.RequestType('java/listOverridableMethods');
425
153
  })(ListOverridableMethodsRequest || (ListOverridableMethodsRequest = {}));
426
-
427
154
  var AddOverridableMethodsRequest;
428
-
429
- /*#__PURE__*/ (function(AddOverridableMethodsRequest) {
430
- AddOverridableMethodsRequest.type = /*#__PURE__*/ new main.RequestType('java/addOverridableMethods');
155
+ (function(AddOverridableMethodsRequest) {
156
+ AddOverridableMethodsRequest.type = new main.RequestType('java/addOverridableMethods');
431
157
  })(AddOverridableMethodsRequest || (AddOverridableMethodsRequest = {}));
432
-
433
158
  var CheckHashCodeEqualsStatusRequest;
434
-
435
- /*#__PURE__*/ (function(CheckHashCodeEqualsStatusRequest) {
436
- CheckHashCodeEqualsStatusRequest.type = /*#__PURE__*/ new main.RequestType('java/checkHashCodeEqualsStatus');
159
+ (function(CheckHashCodeEqualsStatusRequest) {
160
+ CheckHashCodeEqualsStatusRequest.type = new main.RequestType('java/checkHashCodeEqualsStatus');
437
161
  })(
438
162
  CheckHashCodeEqualsStatusRequest || (CheckHashCodeEqualsStatusRequest = {})
439
163
  );
440
-
441
164
  var GenerateHashCodeEqualsRequest;
442
-
443
- /*#__PURE__*/ (function(GenerateHashCodeEqualsRequest) {
444
- GenerateHashCodeEqualsRequest.type = /*#__PURE__*/ new main.RequestType('java/generateHashCodeEquals');
165
+ (function(GenerateHashCodeEqualsRequest) {
166
+ GenerateHashCodeEqualsRequest.type = new main.RequestType('java/generateHashCodeEquals');
445
167
  })(GenerateHashCodeEqualsRequest || (GenerateHashCodeEqualsRequest = {}));
446
-
447
168
  var OrganizeImportsRequest;
448
-
449
- /*#__PURE__*/ (function(OrganizeImportsRequest) {
450
- OrganizeImportsRequest.type = /*#__PURE__*/ new main.RequestType('java/organizeImports');
169
+ (function(OrganizeImportsRequest) {
170
+ OrganizeImportsRequest.type = new main.RequestType('java/organizeImports');
451
171
  })(OrganizeImportsRequest || (OrganizeImportsRequest = {}));
452
-
453
172
  var CheckToStringStatusRequest;
454
-
455
- /*#__PURE__*/ (function(CheckToStringStatusRequest) {
456
- CheckToStringStatusRequest.type = /*#__PURE__*/ new main.RequestType('java/checkToStringStatus');
173
+ (function(CheckToStringStatusRequest) {
174
+ CheckToStringStatusRequest.type = new main.RequestType('java/checkToStringStatus');
457
175
  })(CheckToStringStatusRequest || (CheckToStringStatusRequest = {}));
458
-
459
176
  var GenerateToStringRequest;
460
-
461
- /*#__PURE__*/ (function(GenerateToStringRequest) {
462
- GenerateToStringRequest.type = /*#__PURE__*/ new main.RequestType('java/generateToString');
177
+ (function(GenerateToStringRequest) {
178
+ GenerateToStringRequest.type = new main.RequestType('java/generateToString');
463
179
  })(GenerateToStringRequest || (GenerateToStringRequest = {}));
464
-
465
180
  var AccessorCodeActionRequest;
466
-
467
- /*#__PURE__*/ (function(AccessorCodeActionRequest) {
468
- AccessorCodeActionRequest.type = /*#__PURE__*/ new main.RequestType('java/resolveUnimplementedAccessors');
181
+ (function(AccessorCodeActionRequest) {
182
+ AccessorCodeActionRequest.type = new main.RequestType('java/resolveUnimplementedAccessors');
469
183
  })(AccessorCodeActionRequest || (AccessorCodeActionRequest = {}));
470
-
471
184
  var GenerateAccessorsRequest;
472
-
473
- /*#__PURE__*/ (function(GenerateAccessorsRequest) {
474
- GenerateAccessorsRequest.type = /*#__PURE__*/ new main.RequestType('java/generateAccessors');
185
+ (function(GenerateAccessorsRequest) {
186
+ GenerateAccessorsRequest.type = new main.RequestType('java/generateAccessors');
475
187
  })(GenerateAccessorsRequest || (GenerateAccessorsRequest = {}));
476
-
477
188
  var CheckConstructorStatusRequest;
478
-
479
- /*#__PURE__*/ (function(CheckConstructorStatusRequest) {
480
- CheckConstructorStatusRequest.type = /*#__PURE__*/ new main.RequestType('java/checkConstructorsStatus');
189
+ (function(CheckConstructorStatusRequest) {
190
+ CheckConstructorStatusRequest.type = new main.RequestType('java/checkConstructorsStatus');
481
191
  })(CheckConstructorStatusRequest || (CheckConstructorStatusRequest = {}));
482
-
483
192
  var GenerateConstructorsRequest;
484
-
485
- /*#__PURE__*/ (function(GenerateConstructorsRequest) {
486
- GenerateConstructorsRequest.type = /*#__PURE__*/ new main.RequestType('java/generateConstructors');
193
+ (function(GenerateConstructorsRequest) {
194
+ GenerateConstructorsRequest.type = new main.RequestType('java/generateConstructors');
487
195
  })(GenerateConstructorsRequest || (GenerateConstructorsRequest = {}));
488
-
489
196
  var CheckDelegateMethodsStatusRequest;
490
-
491
- /*#__PURE__*/ (function(CheckDelegateMethodsStatusRequest) {
492
- CheckDelegateMethodsStatusRequest.type = /*#__PURE__*/ new main.RequestType('java/checkDelegateMethodsStatus');
197
+ (function(CheckDelegateMethodsStatusRequest) {
198
+ CheckDelegateMethodsStatusRequest.type = new main.RequestType('java/checkDelegateMethodsStatus');
493
199
  })(
494
200
  CheckDelegateMethodsStatusRequest || (CheckDelegateMethodsStatusRequest = {})
495
201
  );
496
-
497
202
  var GenerateDelegateMethodsRequest;
498
-
499
- /*#__PURE__*/ (function(GenerateDelegateMethodsRequest) {
500
- GenerateDelegateMethodsRequest.type = /*#__PURE__*/ new main.RequestType('java/generateDelegateMethods');
203
+ (function(GenerateDelegateMethodsRequest) {
204
+ GenerateDelegateMethodsRequest.type = new main.RequestType('java/generateDelegateMethods');
501
205
  })(GenerateDelegateMethodsRequest || (GenerateDelegateMethodsRequest = {}));
502
-
503
- /**
504
- * Argument that tells the program where to generate the heap dump that is created when an OutOfMemoryError is raised and `HEAP_DUMP` has been passed
505
- */
506
-
507
206
  const HEAP_DUMP_LOCATION = '-XX:HeapDumpPath=';
508
-
509
- /*#__PURE__*/ new RegExp("".concat(HEAP_DUMP_LOCATION, "(?:'([^']+)'|\"([^\"]+)\"|([^\\s]+))"));
510
-
207
+ new RegExp("".concat(HEAP_DUMP_LOCATION, "(?:'([^']+)'|\"([^\"]+)\"|([^\\s]+))"));
511
208
  function applyWorkspaceEdit(obj, languageClient) {
512
209
  return __awaiter(this, void 0, void 0, function* () {
513
210
  const edit = yield languageClient.protocol2CodeConverter.asWorkspaceEdit(obj);
514
-
515
211
  if (edit) {
516
212
  return workspace.applyEdit(edit);
517
213
  } else {
@@ -519,7 +215,6 @@ function applyWorkspaceEdit(obj, languageClient) {
519
215
  }
520
216
  });
521
217
  }
522
-
523
218
  function registerCommands(languageClient, context) {
524
219
  registerOverrideMethodsCommand(languageClient, context);
525
220
  registerHashCodeEqualsCommand(languageClient, context);
@@ -530,29 +225,22 @@ function registerCommands(languageClient, context) {
530
225
  registerGenerateConstructorsCommand(languageClient, context);
531
226
  registerGenerateDelegateMethodsCommand(languageClient, context);
532
227
  }
533
-
534
228
  function registerOverrideMethodsCommand(languageClient, context) {
535
229
  context.subscriptions.push(commands.registerCommand(Commands.OVERRIDE_METHODS_PROMPT, params => __awaiter(this, void 0, void 0, function* () {
536
230
  const result = yield languageClient.sendRequest(ListOverridableMethodsRequest.type, params);
537
-
538
231
  if (!result || !result.methods || !result.methods.length) {
539
232
  window.showWarningMessage('No overridable methods found in the super type.');
540
233
  return;
541
234
  }
542
-
543
235
  result.methods.sort((a, b) => {
544
236
  const declaringClass = a.declaringClass.localeCompare(b.declaringClass);
545
-
546
237
  if (declaringClass !== 0) {
547
238
  return declaringClass;
548
239
  }
549
-
550
240
  const methodName = a.name.localeCompare(b.name);
551
-
552
241
  if (methodName !== 0) {
553
242
  return methodName;
554
243
  }
555
-
556
244
  return a.parameters.length - b.parameters.length;
557
245
  });
558
246
  const quickPickItems = result.methods.map(method => {
@@ -567,11 +255,9 @@ function registerOverrideMethodsCommand(languageClient, context) {
567
255
  canPickMany: true,
568
256
  placeHolder: "Select methods to override or implement in ".concat(result.type)
569
257
  });
570
-
571
258
  if (!selectedItems || !selectedItems.length) {
572
259
  return;
573
260
  }
574
-
575
261
  const workspaceEdit = yield languageClient.sendRequest(AddOverridableMethodsRequest.type, {
576
262
  context: params,
577
263
  overridableMethods: selectedItems.map(item => item.originalMethod)
@@ -580,28 +266,21 @@ function registerOverrideMethodsCommand(languageClient, context) {
580
266
  yield revealWorkspaceEdit(workspaceEdit, languageClient);
581
267
  })));
582
268
  }
583
-
584
269
  function registerHashCodeEqualsCommand(languageClient, context) {
585
270
  context.subscriptions.push(commands.registerCommand(Commands.HASHCODE_EQUALS_PROMPT, params => __awaiter(this, void 0, void 0, function* () {
586
271
  const result = yield languageClient.sendRequest(CheckHashCodeEqualsStatusRequest.type, params);
587
-
588
272
  if (!result || !result.fields || !result.fields.length) {
589
273
  window.showErrorMessage("The operation is not applicable to the type ".concat(result.type, "."));
590
274
  return;
591
275
  }
592
-
593
276
  let regenerate = false;
594
-
595
277
  if (result.existingMethods && result.existingMethods.length) {
596
278
  const ans = yield window.showInformationMessage("Methods ".concat(result.existingMethods.join(' and '), " already ").concat(result.existingMethods.length === 1 ? 'exists' : 'exist', " in the Class '").concat(result.type, "'. ") + 'Do you want to regenerate the implementation?', 'Regenerate', 'Cancel');
597
-
598
279
  if (ans !== 'Regenerate') {
599
280
  return;
600
281
  }
601
-
602
282
  regenerate = true;
603
283
  }
604
-
605
284
  const fieldItems = result.fields.map(field => {
606
285
  return {
607
286
  label: "".concat(field.name, ": ").concat(field.type),
@@ -613,11 +292,9 @@ function registerHashCodeEqualsCommand(languageClient, context) {
613
292
  canPickMany: true,
614
293
  placeHolder: 'Select the fields to include in the hashCode() and equals() methods.'
615
294
  });
616
-
617
295
  if (!selectedFields || !selectedFields.length) {
618
296
  return;
619
297
  }
620
-
621
298
  const workspaceEdit = yield languageClient.sendRequest(GenerateHashCodeEqualsRequest.type, {
622
299
  context: params,
623
300
  fields: selectedFields.map(item => item.originalField),
@@ -627,22 +304,18 @@ function registerHashCodeEqualsCommand(languageClient, context) {
627
304
  yield revealWorkspaceEdit(workspaceEdit, languageClient);
628
305
  })));
629
306
  }
630
-
631
307
  function registerOrganizeImportsCommand(languageClient, context) {
632
308
  context.subscriptions.push(commands.registerCommand(Commands.ORGANIZE_IMPORTS, params => __awaiter(this, void 0, void 0, function* () {
633
309
  const workspaceEdit = yield languageClient.sendRequest(OrganizeImportsRequest.type, params);
634
310
  yield applyWorkspaceEdit(workspaceEdit, languageClient);
635
311
  })));
636
312
  }
637
-
638
313
  function registerChooseImportCommand(context) {
639
314
  context.subscriptions.push(commands.registerCommand(Commands.CHOOSE_IMPORTS, (uri, selections) => __awaiter(this, void 0, void 0, function* () {
640
315
  const chosen = [];
641
316
  const fileUri = Uri.parse(uri);
642
-
643
317
  for (let i = 0; i < selections.length; i++) {
644
- const selection = selections[i]; // Move the cursor to the code line with ambiguous import choices.
645
-
318
+ const selection = selections[i];
646
319
  yield window.showTextDocument(fileUri, {
647
320
  preserveFocus: true,
648
321
  selection: selection.range,
@@ -658,7 +331,6 @@ function registerChooseImportCommand(context) {
658
331
  const fullyQualifiedName = candidates[0].fullyQualifiedName;
659
332
  const typeName = fullyQualifiedName.substring(fullyQualifiedName.lastIndexOf(".") + 1);
660
333
  const disposables = [];
661
-
662
334
  try {
663
335
  const pick = yield new Promise((resolve, reject) => {
664
336
  const input = window.createQuickPick();
@@ -679,29 +351,22 @@ function registerChooseImportCommand(context) {
679
351
  disposables.forEach(d => d.dispose());
680
352
  }
681
353
  }
682
-
683
354
  return chosen;
684
355
  })));
685
356
  }
686
-
687
357
  function registerGenerateToStringCommand(languageClient, context) {
688
358
  context.subscriptions.push(commands.registerCommand(Commands.GENERATE_TOSTRING_PROMPT, params => __awaiter(this, void 0, void 0, function* () {
689
359
  const result = yield languageClient.sendRequest(CheckToStringStatusRequest.type, params);
690
-
691
360
  if (!result) {
692
361
  return;
693
362
  }
694
-
695
363
  if (result.exists) {
696
364
  const ans = yield window.showInformationMessage("Method 'toString()' already exists in the Class '".concat(result.type, "'. ") + 'Do you want to replace the implementation?', 'Replace', 'Cancel');
697
-
698
365
  if (ans !== 'Replace') {
699
366
  return;
700
367
  }
701
368
  }
702
-
703
369
  let fields = [];
704
-
705
370
  if (result.fields && result.fields.length) {
706
371
  const fieldItems = result.fields.map(field => {
707
372
  return {
@@ -714,14 +379,11 @@ function registerGenerateToStringCommand(languageClient, context) {
714
379
  canPickMany: true,
715
380
  placeHolder: 'Select the fields to include in the toString() method.'
716
381
  });
717
-
718
382
  if (!selectedFields) {
719
383
  return;
720
384
  }
721
-
722
385
  fields = selectedFields.map(item => item.originalField);
723
386
  }
724
-
725
387
  const workspaceEdit = yield languageClient.sendRequest(GenerateToStringRequest.type, {
726
388
  context: params,
727
389
  fields
@@ -730,32 +392,25 @@ function registerGenerateToStringCommand(languageClient, context) {
730
392
  yield revealWorkspaceEdit(workspaceEdit, languageClient);
731
393
  })));
732
394
  }
733
-
734
395
  function registerGenerateAccessorsCommand(languageClient, context) {
735
396
  context.subscriptions.push(commands.registerCommand(Commands.GENERATE_ACCESSORS_PROMPT, params => __awaiter(this, void 0, void 0, function* () {
736
397
  yield generateAccessors(languageClient, params);
737
398
  })));
738
399
  }
739
-
740
400
  function generateAccessors(languageClient, params) {
741
401
  return __awaiter(this, void 0, void 0, function* () {
742
402
  const accessors = yield languageClient.sendRequest(AccessorCodeActionRequest.type, params);
743
-
744
403
  if (!accessors || !accessors.length) {
745
404
  return;
746
405
  }
747
-
748
406
  const accessorItems = accessors.map(accessor => {
749
407
  const description = [];
750
-
751
408
  if (accessor.generateGetter) {
752
409
  description.push('getter');
753
410
  }
754
-
755
411
  if (accessor.generateSetter) {
756
412
  description.push('setter');
757
413
  }
758
-
759
414
  return {
760
415
  label: "".concat(accessor.fieldName, ": ").concat(accessor.typeName),
761
416
  description: (accessor.isStatic ? 'static ' : '') + description.join(', '),
@@ -763,33 +418,26 @@ function generateAccessors(languageClient, params) {
763
418
  };
764
419
  });
765
420
  let accessorsKind;
766
-
767
421
  switch (params.kind) {
768
422
  case AccessorKind.BOTH:
769
423
  accessorsKind = "getters and setters";
770
424
  break;
771
-
772
425
  case AccessorKind.GETTER:
773
426
  accessorsKind = "getters";
774
427
  break;
775
-
776
428
  case AccessorKind.SETTER:
777
429
  accessorsKind = "setters";
778
430
  break;
779
-
780
431
  default:
781
432
  return;
782
433
  }
783
-
784
434
  const selectedAccessors = yield window.showQuickPick(accessorItems, {
785
435
  canPickMany: true,
786
436
  placeHolder: "Select the fields to generate ".concat(accessorsKind)
787
437
  });
788
-
789
438
  if (!selectedAccessors || !selectedAccessors.length) {
790
439
  return;
791
440
  }
792
-
793
441
  const workspaceEdit = yield languageClient.sendRequest(GenerateAccessorsRequest.type, {
794
442
  context: params,
795
443
  accessors: selectedAccessors.map(item => item.originalField)
@@ -798,18 +446,14 @@ function generateAccessors(languageClient, params) {
798
446
  yield revealWorkspaceEdit(workspaceEdit, languageClient);
799
447
  });
800
448
  }
801
-
802
449
  function registerGenerateConstructorsCommand(languageClient, context) {
803
450
  context.subscriptions.push(commands.registerCommand(Commands.GENERATE_CONSTRUCTORS_PROMPT, params => __awaiter(this, void 0, void 0, function* () {
804
451
  const status = yield languageClient.sendRequest(CheckConstructorStatusRequest.type, params);
805
-
806
452
  if (!status || !status.constructors || !status.constructors.length) {
807
453
  return;
808
454
  }
809
-
810
455
  let selectedConstructors = status.constructors;
811
456
  let selectedFields = [];
812
-
813
457
  if (status.constructors.length > 1) {
814
458
  const constructorItems = status.constructors.map(constructor => {
815
459
  return {
@@ -821,14 +465,11 @@ function registerGenerateConstructorsCommand(languageClient, context) {
821
465
  canPickMany: true,
822
466
  placeHolder: 'Select super class constructor(s).'
823
467
  });
824
-
825
468
  if (!selectedConstructorItems || !selectedConstructorItems.length) {
826
469
  return;
827
470
  }
828
-
829
471
  selectedConstructors = selectedConstructorItems.map(item => item.originalConstructor);
830
472
  }
831
-
832
473
  if (status.fields.length) {
833
474
  const fieldItems = status.fields.map(field => {
834
475
  return {
@@ -841,14 +482,11 @@ function registerGenerateConstructorsCommand(languageClient, context) {
841
482
  canPickMany: true,
842
483
  placeHolder: 'Select fields to initialize by constructor(s).'
843
484
  });
844
-
845
485
  if (!selectedFieldItems) {
846
486
  return;
847
487
  }
848
-
849
488
  selectedFields = selectedFieldItems.map(item => item.originalField);
850
489
  }
851
-
852
490
  const workspaceEdit = yield languageClient.sendRequest(GenerateConstructorsRequest.type, {
853
491
  context: params,
854
492
  constructors: selectedConstructors,
@@ -858,18 +496,14 @@ function registerGenerateConstructorsCommand(languageClient, context) {
858
496
  yield revealWorkspaceEdit(workspaceEdit, languageClient);
859
497
  })));
860
498
  }
861
-
862
499
  function registerGenerateDelegateMethodsCommand(languageClient, context) {
863
500
  context.subscriptions.push(commands.registerCommand(Commands.GENERATE_DELEGATE_METHODS_PROMPT, params => __awaiter(this, void 0, void 0, function* () {
864
501
  const status = yield languageClient.sendRequest(CheckDelegateMethodsStatusRequest.type, params);
865
-
866
502
  if (!status || !status.delegateFields || !status.delegateFields.length) {
867
503
  window.showWarningMessage("All delegatable methods are already implemented.");
868
504
  return;
869
505
  }
870
-
871
506
  let selectedDelegateField = status.delegateFields[0];
872
-
873
507
  if (status.delegateFields.length > 1) {
874
508
  const fieldItems = status.delegateFields.map(delegateField => {
875
509
  return {
@@ -880,14 +514,11 @@ function registerGenerateDelegateMethodsCommand(languageClient, context) {
880
514
  const selectedFieldItem = yield window.showQuickPick(fieldItems, {
881
515
  placeHolder: 'Select target to generate delegates for.'
882
516
  });
883
-
884
517
  if (!selectedFieldItem) {
885
518
  return;
886
519
  }
887
-
888
520
  selectedDelegateField = selectedFieldItem.originalField;
889
521
  }
890
-
891
522
  const delegateEntryItems = selectedDelegateField.delegateMethods.map(delegateMethod => {
892
523
  return {
893
524
  label: "".concat(selectedDelegateField.field.name, ".").concat(delegateMethod.name, "(").concat(delegateMethod.parameters.join(','), ")"),
@@ -895,21 +526,17 @@ function registerGenerateDelegateMethodsCommand(languageClient, context) {
895
526
  originalMethod: delegateMethod
896
527
  };
897
528
  });
898
-
899
529
  if (!delegateEntryItems.length) {
900
530
  window.showWarningMessage("All delegatable methods are already implemented.");
901
531
  return;
902
532
  }
903
-
904
533
  const selectedDelegateEntryItems = yield window.showQuickPick(delegateEntryItems, {
905
534
  canPickMany: true,
906
535
  placeHolder: 'Select methods to generate delegates for.'
907
536
  });
908
-
909
537
  if (!selectedDelegateEntryItems || !selectedDelegateEntryItems.length) {
910
538
  return;
911
539
  }
912
-
913
540
  const delegateEntries = selectedDelegateEntryItems.map(item => {
914
541
  return {
915
542
  field: item.originalField,
@@ -924,39 +551,27 @@ function registerGenerateDelegateMethodsCommand(languageClient, context) {
924
551
  yield revealWorkspaceEdit(workspaceEdit, languageClient);
925
552
  })));
926
553
  }
927
-
928
554
  function revealWorkspaceEdit(workspaceEdit, languageClient) {
929
555
  return __awaiter(this, void 0, void 0, function* () {
930
556
  const codeWorkspaceEdit = yield languageClient.protocol2CodeConverter.asWorkspaceEdit(workspaceEdit);
931
-
932
557
  if (!codeWorkspaceEdit) {
933
558
  return;
934
559
  }
935
-
936
560
  for (const entry of codeWorkspaceEdit.entries()) {
937
561
  yield workspace.openTextDocument(entry[0]);
938
-
939
562
  if (entry[1].length > 0) {
940
- // reveal first available change of the workspace edit
941
563
  window.activeTextEditor.revealRange(entry[1][0].range, TextEditorRevealType.InCenter);
942
564
  break;
943
565
  }
944
566
  }
945
567
  });
946
568
  }
947
-
948
569
  class JavaExtensionFeature extends ExtensionFeature {
949
570
  constructor(languageClient) {
950
571
  super();
951
572
  this.languageClient = languageClient;
952
573
  }
953
-
954
574
  activate(context) {
955
- /**
956
- * The next 3 commands come from https://github.com/redhat-developer/vscode-java/blob/4810edd542cecb654ac1152985b4a9da0f921c08/src/standardLanguageClient.ts#L328
957
- * They can't be imported because they are in the middle of a complex function
958
- * Only those 3 are important to us
959
- */
960
575
  context.subscriptions.push(commands.registerCommand(Commands.SHOW_JAVA_REFERENCES, (uri, position, locations) => {
961
576
  void commands.executeCommand(Commands.SHOW_REFERENCES, Uri.parse(uri), this.languageClient.protocol2CodeConverter.asPosition(position), locations.map(this.languageClient.protocol2CodeConverter.asLocation));
962
577
  }));
@@ -968,10 +583,6 @@ class JavaExtensionFeature extends ExtensionFeature {
968
583
  }));
969
584
  context.subscriptions.push(languages.registerInlayHintsProvider(this.languageClient.clientOptions.documentSelector, new JavaInlayHintsProvider(this.languageClient)));
970
585
  registerCommands(this.languageClient, context);
971
- /**
972
- * It comes from https://github.com/redhat-developer/vscode-java/blob/cf8b8bcce9b4bf1691fa3dd89bcd40db0ca093bd/src/providerDispatcher.ts#L30
973
- */
974
-
975
586
  context.subscriptions.push(workspace.registerTextDocumentContentProvider('jdt', {
976
587
  provideTextDocumentContent: async (uri, token) => {
977
588
  return this.languageClient.sendRequest(ClassFileContentsRequest.type, {
@@ -982,7 +593,5 @@ class JavaExtensionFeature extends ExtensionFeature {
982
593
  }
983
594
  }));
984
595
  }
985
-
986
596
  }
987
-
988
597
  export { JavaExtensionFeature };