monaco-languageclient 2.0.0-dev.1 → 2.0.0

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +309 -0
  2. package/License.txt +11 -0
  3. package/dist/amd/console-window.d.ts.map +1 -1
  4. package/dist/amd/console-window.js.map +1 -1
  5. package/dist/amd/disposable.d.ts +2 -2
  6. package/dist/amd/disposable.d.ts.map +1 -1
  7. package/dist/amd/disposable.js +1 -1
  8. package/dist/amd/disposable.js.map +1 -1
  9. package/dist/amd/monaco-converter.d.ts.map +1 -1
  10. package/dist/amd/monaco-converter.js +21 -27
  11. package/dist/amd/monaco-converter.js.map +1 -1
  12. package/dist/amd/monaco-language-client.d.ts +2 -2
  13. package/dist/amd/monaco-language-client.d.ts.map +1 -1
  14. package/dist/amd/monaco-language-client.js +11 -1
  15. package/dist/amd/monaco-language-client.js.map +1 -1
  16. package/dist/amd/monaco-services.d.ts +3 -3
  17. package/dist/amd/monaco-services.d.ts.map +1 -1
  18. package/dist/amd/monaco-services.js.map +1 -1
  19. package/dist/amd/monaco-workspace.d.ts.map +1 -1
  20. package/lib/console-window.d.ts.map +1 -1
  21. package/lib/console-window.js.map +1 -1
  22. package/lib/disposable.d.ts +2 -2
  23. package/lib/disposable.d.ts.map +1 -1
  24. package/lib/disposable.js +2 -2
  25. package/lib/disposable.js.map +1 -1
  26. package/lib/monaco-converter.d.ts.map +1 -1
  27. package/lib/monaco-converter.js +21 -27
  28. package/lib/monaco-converter.js.map +1 -1
  29. package/lib/monaco-language-client.d.ts +2 -2
  30. package/lib/monaco-language-client.d.ts.map +1 -1
  31. package/lib/monaco-language-client.js +34 -28
  32. package/lib/monaco-language-client.js.map +1 -1
  33. package/lib/monaco-services.d.ts +3 -3
  34. package/lib/monaco-services.d.ts.map +1 -1
  35. package/lib/monaco-services.js +3 -3
  36. package/lib/monaco-services.js.map +1 -1
  37. package/lib/monaco-workspace.d.ts.map +1 -1
  38. package/package.json +9 -5
  39. package/src/console-window.ts +11 -10
  40. package/src/disposable.ts +7 -9
  41. package/src/monaco-converter.ts +175 -177
  42. package/src/monaco-language-client.ts +52 -46
  43. package/src/monaco-services.ts +9 -8
  44. package/src/monaco-workspace.ts +2 -2
@@ -29,8 +29,9 @@ export type RecursivePartial<T> = {
29
29
  export interface ProtocolDocumentLink extends monaco.languages.ILink {
30
30
  data?: unknown;
31
31
  }
32
+
32
33
  export namespace ProtocolDocumentLink {
33
- export function is(item: any): item is ProtocolDocumentLink {
34
+ export function is (item: any): item is ProtocolDocumentLink {
34
35
  return !!item && 'data' in item;
35
36
  }
36
37
  }
@@ -38,8 +39,9 @@ export namespace ProtocolDocumentLink {
38
39
  export interface ProtocolCodeLens extends monaco.languages.CodeLens {
39
40
  data?: unknown;
40
41
  }
42
+
41
43
  export namespace ProtocolCodeLens {
42
- export function is(item: any): item is ProtocolCodeLens {
44
+ export function is (item: any): item is ProtocolCodeLens {
43
45
  return !!item && 'data' in item;
44
46
  }
45
47
  }
@@ -53,7 +55,7 @@ export interface ProtocolCompletionItem extends monaco.languages.CompletionItem
53
55
  insertTextMode?: InsertTextMode;
54
56
  }
55
57
  export namespace ProtocolCompletionItem {
56
- export function is(item: any): item is ProtocolCompletionItem {
58
+ export function is (item: any): item is ProtocolCompletionItem {
57
59
  return !!item && 'data' in item;
58
60
  }
59
61
  }
@@ -62,7 +64,7 @@ export interface ProtocolCodeAction extends monaco.languages.CodeAction {
62
64
  data?: unknown;
63
65
  }
64
66
  export namespace ProtocolCodeAction {
65
- export function is(item: any): item is ProtocolCodeAction {
67
+ export function is (item: any): item is ProtocolCodeAction {
66
68
  return !!item && 'data' in item;
67
69
  }
68
70
  }
@@ -71,15 +73,14 @@ export interface ProtocolInlayHint extends monaco.languages.InlayHint {
71
73
  data?: unknown;
72
74
  }
73
75
  export namespace ProtocolInlayHint {
74
- export function is(item: any): item is ProtocolInlayHint {
76
+ export function is (item: any): item is ProtocolInlayHint {
75
77
  return !!item && 'data' in item;
76
78
  }
77
79
  }
78
80
 
79
-
80
81
  type RangeReplace = { insert: monaco.IRange; replace: monaco.IRange }
81
82
 
82
- function isRangeReplace(v: Partial<monaco.IRange> | RangeReplace): v is RangeReplace {
83
+ function isRangeReplace (v: Partial<monaco.IRange> | RangeReplace): v is RangeReplace {
83
84
  return (v as RangeReplace).insert !== undefined;
84
85
  }
85
86
 
@@ -87,14 +88,14 @@ function isRangeReplace(v: Partial<monaco.IRange> | RangeReplace): v is RangeRep
87
88
  * @deprecated use @CodinGame/monaco-vscode-api and vscode-languageclient/lib/common/codeConverter (see browser example)
88
89
  */
89
90
  export class MonacoToProtocolConverter {
90
- public constructor(protected readonly _monaco: typeof monaco) { }
91
+ public constructor (protected readonly _monaco: typeof monaco) { }
91
92
 
92
93
  asPosition(lineNumber: undefined | null, column: undefined | null): {};
93
94
  asPosition(lineNumber: number, column: undefined | null): Pick<Position, 'line'>;
94
95
  asPosition(lineNumber: undefined | null, column: number): Pick<Position, 'character'>;
95
96
  asPosition(lineNumber: number, column: number): Position;
96
97
  asPosition(lineNumber: number | undefined | null, column: number | undefined | null): Partial<Position>;
97
- asPosition(lineNumber: number | undefined | null, column: number | undefined | null): Partial<Position> {
98
+ asPosition (lineNumber: number | undefined | null, column: number | undefined | null): Partial<Position> {
98
99
  const line = lineNumber === undefined || lineNumber === null ? undefined : lineNumber - 1;
99
100
  const character = column === undefined || column === null ? undefined : column - 1;
100
101
  return {
@@ -111,7 +112,7 @@ export class MonacoToProtocolConverter {
111
112
  asRange(range: Partial<monaco.IRange>): RecursivePartial<Range>;
112
113
  asRange(range: Partial<monaco.IRange> | undefined): RecursivePartial<Range> | undefined;
113
114
  asRange(range: Partial<monaco.IRange> | null): RecursivePartial<Range> | null;
114
- asRange(range: Partial<monaco.IRange> | undefined | null | RangeReplace): RecursivePartial<Range> | undefined | null {
115
+ asRange (range: Partial<monaco.IRange> | undefined | null | RangeReplace): RecursivePartial<Range> | undefined | null {
115
116
  if (range === undefined) {
116
117
  return undefined;
117
118
  }
@@ -121,7 +122,6 @@ export class MonacoToProtocolConverter {
121
122
 
122
123
  if (isRangeReplace(range)) {
123
124
  return this.asRange(range.insert);
124
-
125
125
  } else {
126
126
  const start = this.asPosition(range.startLineNumber, range.startColumn);
127
127
  const end = this.asPosition(range.endLineNumber, range.endColumn);
@@ -134,7 +134,7 @@ export class MonacoToProtocolConverter {
134
134
  asLocation(item: monaco.languages.Location): Location;
135
135
  asLocation(item: undefined | null): undefined;
136
136
  asLocation(item: monaco.languages.Location | undefined | null): Location | undefined;
137
- asLocation(item: monaco.languages.Location | undefined | null): Location | undefined {
137
+ asLocation (item: monaco.languages.Location | undefined | null): Location | undefined {
138
138
  if (!item) {
139
139
  return undefined;
140
140
  }
@@ -143,36 +143,36 @@ export class MonacoToProtocolConverter {
143
143
  return {
144
144
  uri,
145
145
  range
146
- }
146
+ };
147
147
  }
148
148
 
149
- asTextDocumentIdentifier(model: monaco.editor.IReadOnlyModel): TextDocumentIdentifier {
149
+ asTextDocumentIdentifier (model: monaco.editor.IReadOnlyModel): TextDocumentIdentifier {
150
150
  return {
151
151
  uri: model.uri.toString()
152
- }
152
+ };
153
153
  }
154
154
 
155
- asTextDocumentPositionParams(model: monaco.editor.IReadOnlyModel, position: monaco.Position): TextDocumentPositionParams {
155
+ asTextDocumentPositionParams (model: monaco.editor.IReadOnlyModel, position: monaco.Position): TextDocumentPositionParams {
156
156
  return {
157
157
  textDocument: this.asTextDocumentIdentifier(model),
158
158
  position: this.asPosition(position.lineNumber, position.column)
159
159
  };
160
160
  }
161
161
 
162
- asCompletionParams(model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.CompletionContext): CompletionParams {
162
+ asCompletionParams (model: monaco.editor.IReadOnlyModel, position: monaco.Position, context: monaco.languages.CompletionContext): CompletionParams {
163
163
  return Object.assign(this.asTextDocumentPositionParams(model, position), {
164
164
  context: this.asCompletionContext(context)
165
165
  });
166
166
  }
167
167
 
168
- asCompletionContext(context: monaco.languages.CompletionContext): CompletionContext {
168
+ asCompletionContext (context: monaco.languages.CompletionContext): CompletionContext {
169
169
  return {
170
170
  triggerKind: this.asCompletionTriggerKind(context.triggerKind),
171
171
  triggerCharacter: context.triggerCharacter
172
- }
172
+ };
173
173
  }
174
174
 
175
- asSignatureHelpContext(context: monaco.languages.SignatureHelpContext): SignatureHelpContext {
175
+ asSignatureHelpContext (context: monaco.languages.SignatureHelpContext): SignatureHelpContext {
176
176
  return {
177
177
  triggerKind: this.asSignatureHelpTriggerKind(context.triggerKind),
178
178
  triggerCharacter: context.triggerCharacter,
@@ -181,7 +181,7 @@ export class MonacoToProtocolConverter {
181
181
  };
182
182
  }
183
183
 
184
- asSignatureHelp(signatureHelp: monaco.languages.SignatureHelp | undefined): SignatureHelp | undefined {
184
+ asSignatureHelp (signatureHelp: monaco.languages.SignatureHelp | undefined): SignatureHelp | undefined {
185
185
  if (signatureHelp === undefined) {
186
186
  return undefined;
187
187
  }
@@ -192,7 +192,7 @@ export class MonacoToProtocolConverter {
192
192
  };
193
193
  }
194
194
 
195
- asSignatureInformation(signatureInformation: monaco.languages.SignatureInformation): SignatureInformation {
195
+ asSignatureInformation (signatureInformation: monaco.languages.SignatureInformation): SignatureInformation {
196
196
  return {
197
197
  documentation: this.asMarkupContent(signatureInformation.documentation),
198
198
  label: signatureInformation.label,
@@ -201,18 +201,18 @@ export class MonacoToProtocolConverter {
201
201
  };
202
202
  }
203
203
 
204
- asParameterInformation(parameterInformation: monaco.languages.ParameterInformation): ParameterInformation {
204
+ asParameterInformation (parameterInformation: monaco.languages.ParameterInformation): ParameterInformation {
205
205
  return {
206
206
  documentation: this.asMarkupContent(parameterInformation.documentation),
207
207
  label: parameterInformation.label
208
208
  };
209
209
  }
210
210
 
211
- asMarkupContent(markupContent: (string | monaco.IMarkdownString | undefined)): string | MarkupContent | undefined {
211
+ asMarkupContent (markupContent: (string | monaco.IMarkdownString | undefined)): string | MarkupContent | undefined {
212
212
  if (markupContent === undefined) {
213
213
  return undefined;
214
214
  }
215
- if (typeof markupContent === "string") {
215
+ if (typeof markupContent === 'string') {
216
216
  return markupContent;
217
217
  }
218
218
  return {
@@ -221,7 +221,7 @@ export class MonacoToProtocolConverter {
221
221
  };
222
222
  }
223
223
 
224
- asSignatureHelpTriggerKind(triggerKind: monaco.languages.SignatureHelpTriggerKind): SignatureHelpTriggerKind {
224
+ asSignatureHelpTriggerKind (triggerKind: monaco.languages.SignatureHelpTriggerKind): SignatureHelpTriggerKind {
225
225
  switch (triggerKind) {
226
226
  case this._monaco.languages.SignatureHelpTriggerKind.ContentChange:
227
227
  return SignatureHelpTriggerKind.ContentChange;
@@ -232,7 +232,7 @@ export class MonacoToProtocolConverter {
232
232
  }
233
233
  }
234
234
 
235
- asCompletionTriggerKind(triggerKind: monaco.languages.CompletionTriggerKind): CompletionTriggerKind {
235
+ asCompletionTriggerKind (triggerKind: monaco.languages.CompletionTriggerKind): CompletionTriggerKind {
236
236
  switch (triggerKind) {
237
237
  case this._monaco.languages.CompletionTriggerKind.TriggerCharacter:
238
238
  return CompletionTriggerKind.TriggerCharacter;
@@ -243,7 +243,7 @@ export class MonacoToProtocolConverter {
243
243
  }
244
244
  }
245
245
 
246
- asCompletionItem(item: monaco.languages.CompletionItem): CompletionItem {
246
+ asCompletionItem (item: monaco.languages.CompletionItem): CompletionItem {
247
247
  const result: CompletionItem = { label: item.label as string };
248
248
  const protocolItem = ProtocolCompletionItem.is(item) ? item : undefined;
249
249
  if (item.detail) { result.detail = item.detail; }
@@ -277,7 +277,7 @@ export class MonacoToProtocolConverter {
277
277
  return result;
278
278
  }
279
279
 
280
- protected asCompletionItemKind(value: monaco.languages.CompletionItemKind, original: CompletionItemKind | undefined): CompletionItemKind {
280
+ protected asCompletionItemKind (value: monaco.languages.CompletionItemKind, original: CompletionItemKind | undefined): CompletionItemKind {
281
281
  if (original !== undefined) {
282
282
  return original;
283
283
  }
@@ -312,7 +312,7 @@ export class MonacoToProtocolConverter {
312
312
  }
313
313
  }
314
314
 
315
- protected asDocumentation(format: string, documentation: string | monaco.IMarkdownString): string | MarkupContent {
315
+ protected asDocumentation (format: string, documentation: string | monaco.IMarkdownString): string | MarkupContent {
316
316
  switch (format) {
317
317
  case MarkupKind.PlainText:
318
318
  return { kind: format, value: documentation as string };
@@ -323,7 +323,7 @@ export class MonacoToProtocolConverter {
323
323
  }
324
324
  }
325
325
 
326
- protected fillPrimaryInsertText(target: CompletionItem, source: ProtocolCompletionItem): void {
326
+ protected fillPrimaryInsertText (target: CompletionItem, source: ProtocolCompletionItem): void {
327
327
  let format: InsertTextFormat = InsertTextFormat.PlainText;
328
328
  let text: string | undefined;
329
329
  let range: Range | undefined;
@@ -340,32 +340,32 @@ export class MonacoToProtocolConverter {
340
340
 
341
341
  target.insertTextFormat = format;
342
342
  if (source.fromEdit && text && range) {
343
- target.textEdit = { newText: text, range: range };
343
+ target.textEdit = { newText: text, range };
344
344
  } else {
345
345
  target.insertText = text;
346
346
  }
347
- target.insertTextMode = source.insertTextMode
347
+ target.insertTextMode = source.insertTextMode;
348
348
  }
349
349
 
350
- asTextEdit(edit: monaco.editor.ISingleEditOperation): TextEdit {
350
+ asTextEdit (edit: monaco.editor.ISingleEditOperation): TextEdit {
351
351
  const range = this.asRange(edit.range)!;
352
352
  return {
353
353
  range,
354
354
  newText: edit.text || ''
355
- }
355
+ };
356
356
  }
357
357
 
358
358
  asTextEdits(items: monaco.editor.ISingleEditOperation[]): TextEdit[];
359
359
  asTextEdits(items: undefined | null): undefined;
360
360
  asTextEdits(items: monaco.editor.ISingleEditOperation[] | undefined | null): TextEdit[] | undefined;
361
- asTextEdits(items: monaco.editor.ISingleEditOperation[] | undefined | null): TextEdit[] | undefined {
361
+ asTextEdits (items: monaco.editor.ISingleEditOperation[] | undefined | null): TextEdit[] | undefined {
362
362
  if (!items) {
363
363
  return undefined;
364
364
  }
365
365
  return items.map(item => this.asTextEdit(item));
366
366
  }
367
367
 
368
- asReferenceParams(model: monaco.editor.IReadOnlyModel, position: monaco.Position, options: { includeDeclaration: boolean; }): ReferenceParams {
368
+ asReferenceParams (model: monaco.editor.IReadOnlyModel, position: monaco.Position, options: { includeDeclaration: boolean; }): ReferenceParams {
369
369
  return {
370
370
  textDocument: this.asTextDocumentIdentifier(model),
371
371
  position: this.asPosition(position.lineNumber, position.column),
@@ -373,19 +373,19 @@ export class MonacoToProtocolConverter {
373
373
  };
374
374
  }
375
375
 
376
- asDocumentSymbolParams(model: monaco.editor.IReadOnlyModel): DocumentSymbolParams {
376
+ asDocumentSymbolParams (model: monaco.editor.IReadOnlyModel): DocumentSymbolParams {
377
377
  return {
378
378
  textDocument: this.asTextDocumentIdentifier(model)
379
- }
379
+ };
380
380
  }
381
381
 
382
- asCodeLensParams(model: monaco.editor.IReadOnlyModel): CodeLensParams {
382
+ asCodeLensParams (model: monaco.editor.IReadOnlyModel): CodeLensParams {
383
383
  return {
384
384
  textDocument: this.asTextDocumentIdentifier(model)
385
- }
385
+ };
386
386
  }
387
387
 
388
- asDiagnosticSeverity(value: monaco.MarkerSeverity): DiagnosticSeverity | undefined {
388
+ asDiagnosticSeverity (value: monaco.MarkerSeverity): DiagnosticSeverity | undefined {
389
389
  switch (value) {
390
390
  case this._monaco.MarkerSeverity.Error:
391
391
  return DiagnosticSeverity.Error;
@@ -399,21 +399,21 @@ export class MonacoToProtocolConverter {
399
399
  return undefined;
400
400
  }
401
401
 
402
- asDiagnostic(marker: monaco.editor.IMarkerData): Diagnostic {
403
- const range = this.asRange(new this._monaco.Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn))
402
+ asDiagnostic (marker: monaco.editor.IMarkerData): Diagnostic {
403
+ const range = this.asRange(new this._monaco.Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn));
404
404
  const severity = this.asDiagnosticSeverity(marker.severity);
405
405
  const diag = Diagnostic.create(range, marker.message, severity, marker.code as string, marker.source);
406
- return diag
406
+ return diag;
407
407
  }
408
408
 
409
- asDiagnostics(markers: monaco.editor.IMarkerData[]): Diagnostic[] {
409
+ asDiagnostics (markers: monaco.editor.IMarkerData[]): Diagnostic[] {
410
410
  if (markers === void 0 || markers === null) {
411
411
  return markers;
412
412
  }
413
413
  return markers.map(marker => this.asDiagnostic(marker));
414
414
  }
415
415
 
416
- asCodeActionContext(context: monaco.languages.CodeActionContext, diagnostics: Diagnostic[]): CodeActionContext {
416
+ asCodeActionContext (context: monaco.languages.CodeActionContext, diagnostics: Diagnostic[]): CodeActionContext {
417
417
  if (context === void 0 || context === null) {
418
418
  return context;
419
419
  }
@@ -421,85 +421,85 @@ export class MonacoToProtocolConverter {
421
421
  return CodeActionContext.create(diagnostics, Is.string(context.only) ? [context.only] : undefined, undefined);
422
422
  }
423
423
 
424
- asCodeActionParams(model: monaco.editor.IReadOnlyModel, range: monaco.Range, context: monaco.languages.CodeActionContext, diagnostics: Diagnostic[]): CodeActionParams {
424
+ asCodeActionParams (model: monaco.editor.IReadOnlyModel, range: monaco.Range, context: monaco.languages.CodeActionContext, diagnostics: Diagnostic[]): CodeActionParams {
425
425
  return {
426
426
  textDocument: this.asTextDocumentIdentifier(model),
427
427
  range: this.asRange(range),
428
428
  context: this.asCodeActionContext(context, diagnostics)
429
- }
429
+ };
430
430
  }
431
431
 
432
- asCommand(item: monaco.languages.Command | undefined | null): Command | undefined {
432
+ asCommand (item: monaco.languages.Command | undefined | null): Command | undefined {
433
433
  if (item) {
434
- let args = item.arguments || [];
434
+ const args = item.arguments || [];
435
435
  return Command.create(item.title, item.id, ...args);
436
436
  }
437
437
  return undefined;
438
438
  }
439
439
 
440
- asCodeLens(item: monaco.languages.CodeLens): CodeLens {
441
- let result = CodeLens.create(this.asRange(item.range));
440
+ asCodeLens (item: monaco.languages.CodeLens): CodeLens {
441
+ const result = CodeLens.create(this.asRange(item.range));
442
442
  if (item.command) { result.command = this.asCommand(item.command); }
443
443
  if (ProtocolCodeLens.is(item)) {
444
- if (item.data) { result.data = item.data };
444
+ if (item.data) { result.data = item.data; }
445
445
  }
446
446
  return result;
447
447
  }
448
448
 
449
- asFormattingOptions(options: monaco.languages.FormattingOptions): FormattingOptions {
449
+ asFormattingOptions (options: monaco.languages.FormattingOptions): FormattingOptions {
450
450
  return { tabSize: options.tabSize, insertSpaces: options.insertSpaces };
451
451
  }
452
452
 
453
- asDocumentFormattingParams(model: monaco.editor.IReadOnlyModel, options: monaco.languages.FormattingOptions): DocumentFormattingParams {
453
+ asDocumentFormattingParams (model: monaco.editor.IReadOnlyModel, options: monaco.languages.FormattingOptions): DocumentFormattingParams {
454
454
  return {
455
455
  textDocument: this.asTextDocumentIdentifier(model),
456
456
  options: this.asFormattingOptions(options)
457
- }
457
+ };
458
458
  }
459
459
 
460
- asDocumentRangeFormattingParams(model: monaco.editor.IReadOnlyModel, range: monaco.Range, options: monaco.languages.FormattingOptions): DocumentRangeFormattingParams {
460
+ asDocumentRangeFormattingParams (model: monaco.editor.IReadOnlyModel, range: monaco.Range, options: monaco.languages.FormattingOptions): DocumentRangeFormattingParams {
461
461
  return {
462
462
  textDocument: this.asTextDocumentIdentifier(model),
463
463
  range: this.asRange(range),
464
464
  options: this.asFormattingOptions(options)
465
- }
465
+ };
466
466
  }
467
467
 
468
- asDocumentOnTypeFormattingParams(model: monaco.editor.IReadOnlyModel, position: monaco.IPosition, ch: string, options: monaco.languages.FormattingOptions): DocumentOnTypeFormattingParams {
468
+ asDocumentOnTypeFormattingParams (model: monaco.editor.IReadOnlyModel, position: monaco.IPosition, ch: string, options: monaco.languages.FormattingOptions): DocumentOnTypeFormattingParams {
469
469
  return {
470
470
  textDocument: this.asTextDocumentIdentifier(model),
471
471
  position: this.asPosition(position.lineNumber, position.column),
472
472
  ch,
473
473
  options: this.asFormattingOptions(options)
474
- }
474
+ };
475
475
  }
476
476
 
477
- asRenameParams(model: monaco.editor.IReadOnlyModel, position: monaco.IPosition, newName: string): RenameParams {
477
+ asRenameParams (model: monaco.editor.IReadOnlyModel, position: monaco.IPosition, newName: string): RenameParams {
478
478
  return {
479
479
  textDocument: this.asTextDocumentIdentifier(model),
480
480
  position: this.asPosition(position.lineNumber, position.column),
481
481
  newName
482
- }
482
+ };
483
483
  }
484
484
 
485
- asDocumentLinkParams(model: monaco.editor.IReadOnlyModel): DocumentLinkParams {
485
+ asDocumentLinkParams (model: monaco.editor.IReadOnlyModel): DocumentLinkParams {
486
486
  return {
487
487
  textDocument: this.asTextDocumentIdentifier(model)
488
- }
488
+ };
489
489
  }
490
490
 
491
- asDocumentLink(item: monaco.languages.ILink): DocumentLink {
492
- let result = DocumentLink.create(this.asRange(item.range));
491
+ asDocumentLink (item: monaco.languages.ILink): DocumentLink {
492
+ const result = DocumentLink.create(this.asRange(item.range));
493
493
  if (item.url) { result.target = typeof item.url === 'string' ? item.url : item.url.toString(); }
494
494
  if (ProtocolDocumentLink.is(item) && item.data) {
495
495
  result.data = item.data;
496
496
  }
497
- if (item.tooltip) { result.tooltip = item.tooltip }
497
+ if (item.tooltip) { result.tooltip = item.tooltip; }
498
498
  return result;
499
499
  }
500
500
 
501
- asCodeAction(item: monaco.languages.CodeAction): CodeAction {
502
- const result: CodeAction = { title: item.title }
501
+ asCodeAction (item: monaco.languages.CodeAction): CodeAction {
502
+ const result: CodeAction = { title: item.title };
503
503
  const protocolCodeAction = ProtocolCodeAction.is(item) ? item : undefined;
504
504
  if (Is.number(item.kind)) {
505
505
  result.kind = item.kind;
@@ -508,7 +508,7 @@ export class MonacoToProtocolConverter {
508
508
  result.diagnostics = this.asDiagnostics(item.diagnostics);
509
509
  }
510
510
  if (item.edit) {
511
- throw new Error(`VS Code code actions can only be converted to a protocol code action without an edit.`);
511
+ throw new Error('VS Code code actions can only be converted to a protocol code action without an edit.');
512
512
  }
513
513
  if (item.command) {
514
514
  result.command = this.asCommand(item.command);
@@ -527,30 +527,30 @@ export class MonacoToProtocolConverter {
527
527
  return result;
528
528
  }
529
529
 
530
- asInlayHintLabelPart(part: monaco.languages.InlayHintLabelPart): InlayHintLabelPart {
530
+ asInlayHintLabelPart (part: monaco.languages.InlayHintLabelPart): InlayHintLabelPart {
531
531
  return {
532
532
  value: part.label,
533
533
  command: this.asCommand(part.command),
534
534
  location: this.asLocation(part.location),
535
535
  tooltip: this.asMarkupContent(part.tooltip)
536
- }
536
+ };
537
537
  }
538
538
 
539
- asInlayHintLabel(label: string | monaco.languages.InlayHintLabelPart[]): string | InlayHintLabelPart[] {
539
+ asInlayHintLabel (label: string | monaco.languages.InlayHintLabelPart[]): string | InlayHintLabelPart[] {
540
540
  if (Array.isArray(label)) {
541
- return label.map(part => this.asInlayHintLabelPart(part))
541
+ return label.map(part => this.asInlayHintLabelPart(part));
542
542
  }
543
- return label
543
+ return label;
544
544
  }
545
545
 
546
- asInlayHint(item: monaco.languages.InlayHint): InlayHint {
547
- let result = InlayHint.create(
546
+ asInlayHint (item: monaco.languages.InlayHint): InlayHint {
547
+ const result = InlayHint.create(
548
548
  this.asPosition(item.position.lineNumber, item.position.column),
549
549
  this.asInlayHintLabel(item.label),
550
550
  item.kind
551
551
  );
552
552
  if (ProtocolInlayHint.is(item)) {
553
- if (item.data) { result.data = item.data };
553
+ if (item.data) { result.data = item.data; }
554
554
  }
555
555
  return result;
556
556
  }
@@ -560,29 +560,29 @@ export class MonacoToProtocolConverter {
560
560
  * @deprecated use @CodinGame/monaco-vscode-api and vscode-languageclient/lib/common/protocolConverter (see browser example)
561
561
  */
562
562
  export class ProtocolToMonacoConverter {
563
- public constructor(protected readonly _monaco: typeof monaco) { }
563
+ public constructor (protected readonly _monaco: typeof monaco) { }
564
564
 
565
- asResourceEdits(resource: monaco.Uri, edits: (TextEdit | AnnotatedTextEdit)[], asMetadata: (annotation: ls.ChangeAnnotationIdentifier | undefined) => monaco.languages.WorkspaceEditMetadata | undefined, modelVersionId?: number): monaco.languages.WorkspaceTextEdit[] {
565
+ asResourceEdits (resource: monaco.Uri, edits: (TextEdit | AnnotatedTextEdit)[], asMetadata: (annotation: ls.ChangeAnnotationIdentifier | undefined) => monaco.languages.WorkspaceEditMetadata | undefined, modelVersionId?: number): monaco.languages.WorkspaceTextEdit[] {
566
566
  return edits.map(edit => ({
567
- resource: resource,
567
+ resource,
568
568
  edit: this.asTextEdit(edit),
569
569
  modelVersionId,
570
570
  metadata: AnnotatedTextEdit.is(edit) ? asMetadata(edit.annotationId) : undefined
571
- }))
571
+ }));
572
572
  }
573
573
 
574
- asWorkspaceEditMetadata(changeAnnotation: ChangeAnnotation): monaco.languages.WorkspaceEditMetadata {
574
+ asWorkspaceEditMetadata (changeAnnotation: ChangeAnnotation): monaco.languages.WorkspaceEditMetadata {
575
575
  return {
576
576
  needsConfirmation: changeAnnotation.needsConfirmation === true,
577
577
  label: changeAnnotation.label,
578
578
  description: changeAnnotation.description
579
- }
579
+ };
580
580
  }
581
581
 
582
582
  asWorkspaceEdit(item: WorkspaceEdit): monaco.languages.WorkspaceEdit;
583
583
  asWorkspaceEdit(item: undefined | null): undefined;
584
584
  asWorkspaceEdit(item: WorkspaceEdit | undefined | null): monaco.languages.WorkspaceEdit | undefined;
585
- asWorkspaceEdit(item: WorkspaceEdit | undefined | null): monaco.languages.WorkspaceEdit | undefined {
585
+ asWorkspaceEdit (item: WorkspaceEdit | undefined | null): monaco.languages.WorkspaceEdit | undefined {
586
586
  if (!item) {
587
587
  return undefined;
588
588
  }
@@ -644,7 +644,7 @@ export class ProtocolToMonacoConverter {
644
644
  asTextEdit(edit: TextEdit): monaco.languages.TextEdit;
645
645
  asTextEdit(edit: undefined | null): undefined;
646
646
  asTextEdit(edit: TextEdit | undefined | null): undefined;
647
- asTextEdit(edit: TextEdit | undefined | null): monaco.languages.TextEdit | undefined {
647
+ asTextEdit (edit: TextEdit | undefined | null): monaco.languages.TextEdit | undefined {
648
648
  if (!edit) {
649
649
  return undefined;
650
650
  }
@@ -652,13 +652,13 @@ export class ProtocolToMonacoConverter {
652
652
  return {
653
653
  range,
654
654
  text: edit.newText
655
- }
655
+ };
656
656
  }
657
657
 
658
658
  asTextEdits(items: TextEdit[]): monaco.languages.TextEdit[];
659
659
  asTextEdits(items: undefined | null): undefined;
660
660
  asTextEdits(items: TextEdit[] | undefined | null): monaco.languages.TextEdit[] | undefined;
661
- asTextEdits(items: TextEdit[] | undefined | null): monaco.languages.TextEdit[] | undefined {
661
+ asTextEdits (items: TextEdit[] | undefined | null): monaco.languages.TextEdit[] | undefined {
662
662
  if (!items) {
663
663
  return undefined;
664
664
  }
@@ -668,12 +668,12 @@ export class ProtocolToMonacoConverter {
668
668
  asCodeLens(item: CodeLens): monaco.languages.CodeLens;
669
669
  asCodeLens(item: undefined | null): undefined;
670
670
  asCodeLens(item: CodeLens | undefined | null): monaco.languages.CodeLens | undefined;
671
- asCodeLens(item: CodeLens | undefined | null): monaco.languages.CodeLens | undefined {
671
+ asCodeLens (item: CodeLens | undefined | null): monaco.languages.CodeLens | undefined {
672
672
  if (!item) {
673
673
  return undefined;
674
674
  }
675
675
  const range = this.asRange(item.range);
676
- let result = <ProtocolCodeLens>{ range };
676
+ const result = <ProtocolCodeLens>{ range };
677
677
  if (item.command) { result.command = this.asCommand(item.command); }
678
678
  if (item.data !== void 0 && item.data !== null) { result.data = item.data; }
679
679
  return result;
@@ -682,7 +682,7 @@ export class ProtocolToMonacoConverter {
682
682
  asCodeLensList(items: CodeLens[]): monaco.languages.CodeLensList;
683
683
  asCodeLensList(items: undefined | null): undefined;
684
684
  asCodeLensList(items: CodeLens[] | undefined | null): monaco.languages.CodeLensList | undefined;
685
- asCodeLensList(items: CodeLens[] | undefined | null): monaco.languages.CodeLensList | undefined {
685
+ asCodeLensList (items: CodeLens[] | undefined | null): monaco.languages.CodeLensList | undefined {
686
686
  if (!items) {
687
687
  return undefined;
688
688
  }
@@ -692,14 +692,14 @@ export class ProtocolToMonacoConverter {
692
692
  };
693
693
  }
694
694
 
695
- asCodeActionList(actions: (Command | CodeAction)[]): monaco.languages.CodeActionList {
695
+ asCodeActionList (actions: (Command | CodeAction)[]): monaco.languages.CodeActionList {
696
696
  return {
697
697
  actions: actions.map(action => this.asCodeAction(action)),
698
698
  dispose: () => { }
699
699
  };
700
700
  }
701
701
 
702
- asCodeAction(item: Command | CodeAction): ProtocolCodeAction {
702
+ asCodeAction (item: Command | CodeAction): ProtocolCodeAction {
703
703
  if (Command.is(item)) {
704
704
  return {
705
705
  command: {
@@ -725,7 +725,7 @@ export class ProtocolToMonacoConverter {
725
725
  asCommand(command: Command): monaco.languages.Command;
726
726
  asCommand(command: undefined): undefined;
727
727
  asCommand(command: Command | undefined): monaco.languages.Command | undefined;
728
- asCommand(command: Command | undefined): monaco.languages.Command | undefined {
728
+ asCommand (command: Command | undefined): monaco.languages.Command | undefined {
729
729
  if (!command) {
730
730
  return undefined;
731
731
  }
@@ -736,11 +736,11 @@ export class ProtocolToMonacoConverter {
736
736
  };
737
737
  }
738
738
 
739
- asDocumentSymbol(value: DocumentSymbol): monaco.languages.DocumentSymbol {
739
+ asDocumentSymbol (value: DocumentSymbol): monaco.languages.DocumentSymbol {
740
740
  const children = value.children && value.children.map(c => this.asDocumentSymbol(c));
741
741
  return {
742
742
  name: value.name,
743
- detail: value.detail || "",
743
+ detail: value.detail || '',
744
744
  kind: this.asSymbolKind(value.kind),
745
745
  tags: value.tags || [],
746
746
  range: this.asRange(value.range),
@@ -749,7 +749,7 @@ export class ProtocolToMonacoConverter {
749
749
  };
750
750
  }
751
751
 
752
- asDocumentSymbols(values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.DocumentSymbol[] {
752
+ asDocumentSymbols (values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.DocumentSymbol[] {
753
753
  if (DocumentSymbol.is(values[0])) {
754
754
  return (values as DocumentSymbol[]).map(s => this.asDocumentSymbol(s));
755
755
  }
@@ -759,14 +759,14 @@ export class ProtocolToMonacoConverter {
759
759
  asSymbolInformations(values: SymbolInformation[], uri?: monaco.Uri): monaco.languages.DocumentSymbol[];
760
760
  asSymbolInformations(values: undefined | null, uri?: monaco.Uri): undefined;
761
761
  asSymbolInformations(values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.DocumentSymbol[] | undefined;
762
- asSymbolInformations(values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.DocumentSymbol[] | undefined {
762
+ asSymbolInformations (values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.DocumentSymbol[] | undefined {
763
763
  if (!values) {
764
764
  return undefined;
765
765
  }
766
766
  return values.map(information => this.asSymbolInformation(information, uri));
767
767
  }
768
768
 
769
- asSymbolInformation(item: SymbolInformation, uri?: monaco.Uri): monaco.languages.DocumentSymbol {
769
+ asSymbolInformation (item: SymbolInformation, uri?: monaco.Uri): monaco.languages.DocumentSymbol {
770
770
  const location = this.asLocation(uri ? { ...item.location, uri: uri.toString() } : item.location);
771
771
  return {
772
772
  name: item.name,
@@ -779,7 +779,7 @@ export class ProtocolToMonacoConverter {
779
779
  };
780
780
  }
781
781
 
782
- asSymbolKind(item: SymbolKind): monaco.languages.SymbolKind {
782
+ asSymbolKind (item: SymbolKind): monaco.languages.SymbolKind {
783
783
  if (item <= SymbolKind.TypeParameter) {
784
784
  // Symbol kind is one based in the protocol and zero based in code.
785
785
  return item - 1;
@@ -790,20 +790,20 @@ export class ProtocolToMonacoConverter {
790
790
  asDocumentHighlights(values: DocumentHighlight[]): monaco.languages.DocumentHighlight[];
791
791
  asDocumentHighlights(values: undefined | null): undefined;
792
792
  asDocumentHighlights(values: DocumentHighlight[] | undefined | null): monaco.languages.DocumentHighlight[] | undefined;
793
- asDocumentHighlights(values: DocumentHighlight[] | undefined | null): monaco.languages.DocumentHighlight[] | undefined {
793
+ asDocumentHighlights (values: DocumentHighlight[] | undefined | null): monaco.languages.DocumentHighlight[] | undefined {
794
794
  if (!values) {
795
795
  return undefined;
796
796
  }
797
797
  return values.map(item => this.asDocumentHighlight(item));
798
798
  }
799
799
 
800
- asDocumentHighlight(item: DocumentHighlight): monaco.languages.DocumentHighlight {
800
+ asDocumentHighlight (item: DocumentHighlight): monaco.languages.DocumentHighlight {
801
801
  const range = this.asRange(item.range)!;
802
802
  const kind = Is.number(item.kind) ? this.asDocumentHighlightKind(item.kind) : undefined!;
803
803
  return { range, kind };
804
804
  }
805
805
 
806
- asDocumentHighlightKind(item: number): monaco.languages.DocumentHighlightKind {
806
+ asDocumentHighlightKind (item: number): monaco.languages.DocumentHighlightKind {
807
807
  switch (item) {
808
808
  case DocumentHighlightKind.Text:
809
809
  return this._monaco.languages.DocumentHighlightKind.Text;
@@ -818,7 +818,7 @@ export class ProtocolToMonacoConverter {
818
818
  asReferences(values: Location[]): monaco.languages.Location[];
819
819
  asReferences(values: undefined | null): monaco.languages.Location[] | undefined;
820
820
  asReferences(values: Location[] | undefined | null): monaco.languages.Location[] | undefined;
821
- asReferences(values: Location[] | undefined | null): monaco.languages.Location[] | undefined {
821
+ asReferences (values: Location[] | undefined | null): monaco.languages.Location[] | undefined {
822
822
  if (!values) {
823
823
  return undefined;
824
824
  }
@@ -829,18 +829,18 @@ export class ProtocolToMonacoConverter {
829
829
  asDefinitionResult(item: DefinitionLink[]): monaco.languages.Definition;
830
830
  asDefinitionResult(item: undefined | null): undefined;
831
831
  asDefinitionResult(item: Definition | DefinitionLink[] | undefined | null): monaco.languages.Definition | undefined;
832
- asDefinitionResult(item: Definition | DefinitionLink[] | undefined | null): monaco.languages.Definition | undefined {
832
+ asDefinitionResult (item: Definition | DefinitionLink[] | undefined | null): monaco.languages.Definition | undefined {
833
833
  if (!item) {
834
834
  return undefined;
835
835
  }
836
836
  if (Is.array(item)) {
837
- if (item.length == 0) {
837
+ if (item.length === 0) {
838
838
  return undefined;
839
839
  } else if (LocationLink.is(item[0])) {
840
- let links: LocationLink[] = item as LocationLink[];
840
+ const links: LocationLink[] = item as LocationLink[];
841
841
  return links.map((location) => this.asLocationLink(location));
842
842
  } else {
843
- let locations: Location[] = item as Location[];
843
+ const locations: Location[] = item as Location[];
844
844
  return locations.map((location) => this.asLocation(location));
845
845
  }
846
846
  } else {
@@ -851,7 +851,7 @@ export class ProtocolToMonacoConverter {
851
851
  asLocation(item: Location): monaco.languages.Location;
852
852
  asLocation(item: undefined | null): undefined;
853
853
  asLocation(item: Location | undefined | null): monaco.languages.Location | undefined;
854
- asLocation(item: Location | undefined | null): monaco.languages.Location | undefined {
854
+ asLocation (item: Location | undefined | null): monaco.languages.Location | undefined {
855
855
  if (!item) {
856
856
  return undefined;
857
857
  }
@@ -859,23 +859,23 @@ export class ProtocolToMonacoConverter {
859
859
  const range = this.asRange(item.range)!;
860
860
  return {
861
861
  uri, range
862
- }
862
+ };
863
863
  }
864
864
 
865
865
  asLocationLink(item: undefined | null): undefined;
866
866
  asLocationLink(item: ls.LocationLink): monaco.languages.LocationLink;
867
- asLocationLink(item: ls.LocationLink | undefined | null): monaco.languages.LocationLink | undefined {
867
+ asLocationLink (item: ls.LocationLink | undefined | null): monaco.languages.LocationLink | undefined {
868
868
  if (!item) {
869
869
  return undefined;
870
870
  }
871
- let result: monaco.languages.LocationLink = {
871
+ const result: monaco.languages.LocationLink = {
872
872
  uri: this._monaco.Uri.parse(item.targetUri),
873
873
  range: this.asRange(item.targetSelectionRange)!, // See issue: https://github.com/Microsoft/vscode/issues/58649
874
874
  originSelectionRange: this.asRange(item.originSelectionRange),
875
875
  targetSelectionRange: this.asRange(item.targetSelectionRange)
876
876
  };
877
877
  if (!result.targetSelectionRange) {
878
- throw new Error(`targetSelectionRange must not be undefined or null`);
878
+ throw new Error('targetSelectionRange must not be undefined or null');
879
879
  }
880
880
  return result;
881
881
  }
@@ -883,11 +883,11 @@ export class ProtocolToMonacoConverter {
883
883
  asSignatureHelpResult(item: undefined | null): undefined;
884
884
  asSignatureHelpResult(item: SignatureHelp): monaco.languages.SignatureHelpResult;
885
885
  asSignatureHelpResult(item: SignatureHelp | undefined | null): monaco.languages.SignatureHelpResult | undefined;
886
- asSignatureHelpResult(item: SignatureHelp | undefined | null): monaco.languages.SignatureHelpResult | undefined {
886
+ asSignatureHelpResult (item: SignatureHelp | undefined | null): monaco.languages.SignatureHelpResult | undefined {
887
887
  if (!item) {
888
888
  return undefined;
889
889
  }
890
- let result = <monaco.languages.SignatureHelp>{};
890
+ const result = <monaco.languages.SignatureHelp>{};
891
891
  if (Is.number(item.activeSignature)) {
892
892
  result.activeSignature = item.activeSignature;
893
893
  } else {
@@ -911,36 +911,36 @@ export class ProtocolToMonacoConverter {
911
911
  };
912
912
  }
913
913
 
914
- asSignatureInformations(items: SignatureInformation[]): monaco.languages.SignatureInformation[] {
914
+ asSignatureInformations (items: SignatureInformation[]): monaco.languages.SignatureInformation[] {
915
915
  return items.map(item => this.asSignatureInformation(item));
916
916
  }
917
917
 
918
- asSignatureInformation(item: SignatureInformation): monaco.languages.SignatureInformation {
919
- let result = <monaco.languages.SignatureInformation>{ label: item.label };
918
+ asSignatureInformation (item: SignatureInformation): monaco.languages.SignatureInformation {
919
+ const result = <monaco.languages.SignatureInformation>{ label: item.label };
920
920
  if (item.documentation) { result.documentation = this.asDocumentation(item.documentation); }
921
921
  if (item.parameters) {
922
922
  result.parameters = this.asParameterInformations(item.parameters);
923
923
  } else {
924
924
  result.parameters = [];
925
925
  }
926
- if (item.activeParameter) { result.activeParameter = item.activeParameter }
926
+ if (item.activeParameter) { result.activeParameter = item.activeParameter; }
927
927
  return result;
928
928
  }
929
929
 
930
- asParameterInformations(item: ParameterInformation[]): monaco.languages.ParameterInformation[] {
930
+ asParameterInformations (item: ParameterInformation[]): monaco.languages.ParameterInformation[] {
931
931
  return item.map(item => this.asParameterInformation(item));
932
932
  }
933
933
 
934
- asParameterInformation(item: ParameterInformation): monaco.languages.ParameterInformation {
935
- let result = <monaco.languages.ParameterInformation>{ label: item.label };
936
- if (item.documentation) { result.documentation = this.asDocumentation(item.documentation) };
934
+ asParameterInformation (item: ParameterInformation): monaco.languages.ParameterInformation {
935
+ const result = <monaco.languages.ParameterInformation>{ label: item.label };
936
+ if (item.documentation) { result.documentation = this.asDocumentation(item.documentation); }
937
937
  return result;
938
938
  }
939
939
 
940
940
  asHover(hover: Hover): monaco.languages.Hover;
941
941
  asHover(hover: undefined | null): undefined;
942
942
  asHover(hover: Hover | undefined | null): monaco.languages.Hover | undefined;
943
- asHover(hover: Hover | undefined | null): monaco.languages.Hover | undefined {
943
+ asHover (hover: Hover | undefined | null): monaco.languages.Hover | undefined {
944
944
  if (!hover) {
945
945
  return undefined;
946
946
  }
@@ -950,14 +950,14 @@ export class ProtocolToMonacoConverter {
950
950
  };
951
951
  }
952
952
 
953
- asHoverContent(contents: MarkedString | MarkedString[] | MarkupContent): monaco.IMarkdownString[] {
953
+ asHoverContent (contents: MarkedString | MarkedString[] | MarkupContent): monaco.IMarkdownString[] {
954
954
  if (Array.isArray(contents)) {
955
955
  return contents.map(content => this.asMarkdownString(content));
956
956
  }
957
957
  return [this.asMarkdownString(contents)];
958
958
  }
959
959
 
960
- asDocumentation(value: string | MarkupContent): string | monaco.IMarkdownString {
960
+ asDocumentation (value: string | MarkupContent): string | monaco.IMarkdownString {
961
961
  if (Is.string(value)) {
962
962
  return value;
963
963
  }
@@ -967,7 +967,7 @@ export class ProtocolToMonacoConverter {
967
967
  return this.asMarkdownString(value);
968
968
  }
969
969
 
970
- asMarkdownString(content: MarkedString | MarkupContent): monaco.IMarkdownString {
970
+ asMarkdownString (content: MarkedString | MarkupContent): monaco.IMarkdownString {
971
971
  if (MarkupContent.is(content)) {
972
972
  return {
973
973
  value: content.value
@@ -982,7 +982,7 @@ export class ProtocolToMonacoConverter {
982
982
  };
983
983
  }
984
984
 
985
- asSeverity(severity?: ls.DiagnosticSeverity): monaco.MarkerSeverity {
985
+ asSeverity (severity?: ls.DiagnosticSeverity): monaco.MarkerSeverity {
986
986
  if (severity === 1) {
987
987
  return this._monaco.MarkerSeverity.Error;
988
988
  }
@@ -998,16 +998,16 @@ export class ProtocolToMonacoConverter {
998
998
  asDiagnostics(diagnostics: undefined): undefined;
999
999
  asDiagnostics(diagnostics: Diagnostic[]): monaco.editor.IMarkerData[];
1000
1000
  asDiagnostics(diagnostics: Diagnostic[] | undefined): monaco.editor.IMarkerData[] | undefined;
1001
- asDiagnostics(diagnostics: Diagnostic[] | undefined): monaco.editor.IMarkerData[] | undefined {
1001
+ asDiagnostics (diagnostics: Diagnostic[] | undefined): monaco.editor.IMarkerData[] | undefined {
1002
1002
  if (!diagnostics) {
1003
1003
  return undefined;
1004
1004
  }
1005
1005
  return diagnostics.map(diagnostic => this.asDiagnostic(diagnostic));
1006
1006
  }
1007
1007
 
1008
- asDiagnostic(diagnostic: Diagnostic): monaco.editor.IMarkerData {
1008
+ asDiagnostic (diagnostic: Diagnostic): monaco.editor.IMarkerData {
1009
1009
  return {
1010
- code: typeof diagnostic.code === "number" ? diagnostic.code.toString() : diagnostic.code,
1010
+ code: typeof diagnostic.code === 'number' ? diagnostic.code.toString() : diagnostic.code,
1011
1011
  severity: this.asSeverity(diagnostic.severity),
1012
1012
  message: diagnostic.message,
1013
1013
  source: diagnostic.source,
@@ -1017,17 +1017,17 @@ export class ProtocolToMonacoConverter {
1017
1017
  endColumn: diagnostic.range.end.character + 1,
1018
1018
  relatedInformation: this.asRelatedInformations(diagnostic.relatedInformation),
1019
1019
  tags: diagnostic.tags
1020
- }
1020
+ };
1021
1021
  }
1022
1022
 
1023
- asRelatedInformations(relatedInformation?: DiagnosticRelatedInformation[]): monaco.editor.IRelatedInformation[] | undefined {
1023
+ asRelatedInformations (relatedInformation?: DiagnosticRelatedInformation[]): monaco.editor.IRelatedInformation[] | undefined {
1024
1024
  if (!relatedInformation) {
1025
1025
  return undefined;
1026
1026
  }
1027
1027
  return relatedInformation.map(item => this.asRelatedInformation(item));
1028
1028
  }
1029
1029
 
1030
- asRelatedInformation(relatedInformation: DiagnosticRelatedInformation): monaco.editor.IRelatedInformation {
1030
+ asRelatedInformation (relatedInformation: DiagnosticRelatedInformation): monaco.editor.IRelatedInformation {
1031
1031
  return {
1032
1032
  resource: this._monaco.Uri.parse(relatedInformation.location.uri),
1033
1033
  startLineNumber: relatedInformation.location.range.start.line + 1,
@@ -1035,37 +1035,37 @@ export class ProtocolToMonacoConverter {
1035
1035
  endLineNumber: relatedInformation.location.range.end.line + 1,
1036
1036
  endColumn: relatedInformation.location.range.end.character + 1,
1037
1037
  message: relatedInformation.message
1038
- }
1038
+ };
1039
1039
  }
1040
1040
 
1041
- asCompletionResult(result: CompletionItem[] | CompletionList | null | undefined, defaultMonacoRange: monaco.IRange): monaco.languages.CompletionList {
1041
+ asCompletionResult (result: CompletionItem[] | CompletionList | null | undefined, defaultMonacoRange: monaco.IRange): monaco.languages.CompletionList {
1042
1042
  if (!result) {
1043
1043
  return {
1044
1044
  incomplete: false,
1045
1045
  suggestions: []
1046
- }
1046
+ };
1047
1047
  }
1048
1048
  if (Array.isArray(result)) {
1049
1049
  const suggestions = result.map(item => this.asCompletionItem(item, defaultMonacoRange, defaultRange));
1050
1050
  return {
1051
1051
  incomplete: false,
1052
1052
  suggestions
1053
- }
1053
+ };
1054
1054
  }
1055
1055
  const defaultRange = this.getCompletionItemDefaultRange(result);
1056
1056
  return {
1057
1057
  incomplete: result.isIncomplete,
1058
1058
  suggestions: result.items.map(item => this.asCompletionItem(item, defaultMonacoRange, defaultRange, result.itemDefaults))
1059
- }
1059
+ };
1060
1060
  }
1061
1061
 
1062
- asCompletionItem(item: CompletionItem, defaultMonacoRange: monaco.IRange | RangeReplace, defaultRange?: monaco.IRange | RangeReplace, itemDefaults?: CompletionList['itemDefaults']): ProtocolCompletionItem {
1062
+ asCompletionItem (item: CompletionItem, defaultMonacoRange: monaco.IRange | RangeReplace, defaultRange?: monaco.IRange | RangeReplace, itemDefaults?: CompletionList['itemDefaults']): ProtocolCompletionItem {
1063
1063
  const result = <ProtocolCompletionItem>{ label: this.asCompletionItemLabel(item) };
1064
1064
  if (item.detail) { result.detail = item.detail; }
1065
1065
  if (item.documentation) {
1066
1066
  result.documentation = this.asDocumentation(item.documentation);
1067
1067
  result.documentationFormat = Is.string(item.documentation) ? undefined : item.documentation.kind;
1068
- };
1068
+ }
1069
1069
  if (item.filterText) { result.filterText = item.filterText; }
1070
1070
  const insertText = this.asCompletionInsertText(item, defaultRange, itemDefaults?.insertTextFormat);
1071
1071
  result.insertText = insertText.insertText;
@@ -1075,7 +1075,7 @@ export class ProtocolToMonacoConverter {
1075
1075
  result.insertTextRules = this._monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;
1076
1076
  }
1077
1077
  if (Is.number(item.kind)) {
1078
- let [itemKind, original] = this.asCompletionItemKind(item.kind);
1078
+ const [itemKind, original] = this.asCompletionItemKind(item.kind);
1079
1079
  result.kind = itemKind;
1080
1080
  if (original) {
1081
1081
  result.originalItemKind = original;
@@ -1092,13 +1092,13 @@ export class ProtocolToMonacoConverter {
1092
1092
  if (item.deprecated === true || item.deprecated === false) {
1093
1093
  result.deprecated = item.deprecated;
1094
1094
  }
1095
- const insertTextMode = item.insertTextMode ?? itemDefaults?.insertTextMode
1095
+ const insertTextMode = item.insertTextMode ?? itemDefaults?.insertTextMode;
1096
1096
  if (insertTextMode) { result.insertTextMode = insertTextMode; }
1097
1097
  if (item.tags) { result.tags = item.tags; }
1098
1098
  return result;
1099
1099
  }
1100
1100
 
1101
- getCompletionItemDefaultRange(list: CompletionList): monaco.Range | RangeReplace | undefined {
1101
+ getCompletionItemDefaultRange (list: CompletionList): monaco.Range | RangeReplace | undefined {
1102
1102
  const rangeDefaults = list.itemDefaults?.editRange;
1103
1103
  return ls.Range.is(rangeDefaults)
1104
1104
  ? this.asRange(rangeDefaults)
@@ -1107,7 +1107,7 @@ export class ProtocolToMonacoConverter {
1107
1107
  : undefined;
1108
1108
  }
1109
1109
 
1110
- asCompletionItemLabel(item: ls.CompletionItem): monaco.languages.CompletionItemLabel | string {
1110
+ asCompletionItemLabel (item: ls.CompletionItem): monaco.languages.CompletionItemLabel | string {
1111
1111
  if (ls.CompletionItemLabelDetails.is(item.labelDetails)) {
1112
1112
  return {
1113
1113
  label: item.label,
@@ -1119,7 +1119,7 @@ export class ProtocolToMonacoConverter {
1119
1119
  }
1120
1120
  }
1121
1121
 
1122
- asCompletionItemKind(value: CompletionItemKind): [monaco.languages.CompletionItemKind, CompletionItemKind | undefined] {
1122
+ asCompletionItemKind (value: CompletionItemKind): [monaco.languages.CompletionItemKind, CompletionItemKind | undefined] {
1123
1123
  if (CompletionItemKind.Text <= value && value <= CompletionItemKind.TypeParameter) {
1124
1124
  switch (value) {
1125
1125
  case CompletionItemKind.Text: return [this._monaco.languages.CompletionItemKind.Text, undefined];
@@ -1149,12 +1149,11 @@ export class ProtocolToMonacoConverter {
1149
1149
  case CompletionItemKind.TypeParameter: return [this._monaco.languages.CompletionItemKind.TypeParameter, undefined];
1150
1150
  default: return [value - 1, undefined];
1151
1151
  }
1152
-
1153
- };
1152
+ }
1154
1153
  return [CompletionItemKind.Text, value];
1155
1154
  }
1156
1155
 
1157
- asCompletionInsertText(item: CompletionItem, defaultRange?: monaco.IRange | RangeReplace, defaultInsertTextFormat?: InsertTextFormat): { insertText: string, range?: monaco.IRange | RangeReplace, fromEdit: boolean, isSnippet: boolean } {
1156
+ asCompletionInsertText (item: CompletionItem, defaultRange?: monaco.IRange | RangeReplace, defaultInsertTextFormat?: InsertTextFormat): { insertText: string, range?: monaco.IRange | RangeReplace, fromEdit: boolean, isSnippet: boolean } {
1158
1157
  const insertTextFormat = item.insertTextFormat ?? defaultInsertTextFormat;
1159
1158
 
1160
1159
  const isSnippet = insertTextFormat === InsertTextFormat.Snippet;
@@ -1163,14 +1162,14 @@ export class ProtocolToMonacoConverter {
1163
1162
  ? this.getCompletionRangeAndText(item.textEdit)
1164
1163
  : [defaultRange, item.textEditText ?? item.label];
1165
1164
 
1166
- return { insertText: newText, range: range, fromEdit: true, isSnippet };
1165
+ return { insertText: newText, range, fromEdit: true, isSnippet };
1167
1166
  } else if (item.insertText) {
1168
1167
  return { isSnippet, insertText: item.insertText, fromEdit: false, range: defaultRange };
1169
1168
  }
1170
1169
  return { insertText: item.label, range: defaultRange, fromEdit: false, isSnippet: false };
1171
1170
  }
1172
1171
 
1173
- getCompletionRangeAndText(value: ls.TextEdit | ls.InsertReplaceEdit): [monaco.Range | RangeReplace, string] {
1172
+ getCompletionRangeAndText (value: ls.TextEdit | ls.InsertReplaceEdit): [monaco.Range | RangeReplace, string] {
1174
1173
  if (ls.InsertReplaceEdit.is(value)) {
1175
1174
  return [{ insert: this.asRange(value.insert), replace: this.asRange(value.replace) }, value.newText];
1176
1175
  } else {
@@ -1178,12 +1177,12 @@ export class ProtocolToMonacoConverter {
1178
1177
  }
1179
1178
  }
1180
1179
 
1181
- asDocumentLinks(documentLinks: DocumentLink[]): monaco.languages.ILinksList {
1180
+ asDocumentLinks (documentLinks: DocumentLink[]): monaco.languages.ILinksList {
1182
1181
  const links = documentLinks.map(link => this.asDocumentLink(link));
1183
1182
  return { links };
1184
1183
  }
1185
1184
 
1186
- asDocumentLink(documentLink: DocumentLink): ProtocolDocumentLink {
1185
+ asDocumentLink (documentLink: DocumentLink): ProtocolDocumentLink {
1187
1186
  return {
1188
1187
  range: this.asRange(documentLink.range),
1189
1188
  url: documentLink.target,
@@ -1200,7 +1199,7 @@ export class ProtocolToMonacoConverter {
1200
1199
  asRange(range: RecursivePartial<Range>): Partial<monaco.IRange>;
1201
1200
  asRange(range: RecursivePartial<Range> | undefined): monaco.Range | Partial<monaco.IRange> | undefined;
1202
1201
  asRange(range: RecursivePartial<Range> | null): monaco.Range | Partial<monaco.IRange> | null;
1203
- asRange(range: RecursivePartial<Range> | undefined | null): monaco.Range | Partial<monaco.IRange> | undefined | null {
1202
+ asRange (range: RecursivePartial<Range> | undefined | null): monaco.Range | Partial<monaco.IRange> | undefined | null {
1204
1203
  if (range === undefined) {
1205
1204
  return undefined;
1206
1205
  }
@@ -1227,7 +1226,7 @@ export class ProtocolToMonacoConverter {
1227
1226
  asPosition(position: Partial<Position>): Partial<monaco.IPosition>;
1228
1227
  asPosition(position: Partial<Position> | undefined): monaco.Position | Partial<monaco.IPosition> | undefined;
1229
1228
  asPosition(position: Partial<Position> | null): monaco.Position | Partial<monaco.IPosition> | null;
1230
- asPosition(position: Partial<Position> | undefined | null): monaco.Position | Partial<monaco.IPosition> | undefined | null {
1229
+ asPosition (position: Partial<Position> | undefined | null): monaco.Position | Partial<monaco.IPosition> | undefined | null {
1231
1230
  if (position === undefined) {
1232
1231
  return undefined;
1233
1232
  }
@@ -1243,39 +1242,39 @@ export class ProtocolToMonacoConverter {
1243
1242
  return { lineNumber, column };
1244
1243
  }
1245
1244
 
1246
- asColorInformations(items: ColorInformation[]): monaco.languages.IColorInformation[] {
1245
+ asColorInformations (items: ColorInformation[]): monaco.languages.IColorInformation[] {
1247
1246
  return items.map(item => this.asColorInformation(item));
1248
1247
  }
1249
1248
 
1250
- asColorInformation(item: ColorInformation): monaco.languages.IColorInformation {
1249
+ asColorInformation (item: ColorInformation): monaco.languages.IColorInformation {
1251
1250
  return {
1252
1251
  range: this.asRange(item.range),
1253
1252
  color: item.color
1254
- }
1253
+ };
1255
1254
  }
1256
1255
 
1257
- asColorPresentations(items: ColorPresentation[]): monaco.languages.IColorPresentation[] {
1256
+ asColorPresentations (items: ColorPresentation[]): monaco.languages.IColorPresentation[] {
1258
1257
  return items.map(item => this.asColorPresentation(item));
1259
1258
  }
1260
1259
 
1261
- asColorPresentation(item: ColorPresentation): monaco.languages.IColorPresentation {
1260
+ asColorPresentation (item: ColorPresentation): monaco.languages.IColorPresentation {
1262
1261
  return {
1263
1262
  label: item.label,
1264
1263
  textEdit: this.asTextEdit(item.textEdit),
1265
1264
  additionalTextEdits: this.asTextEdits(item.additionalTextEdits)
1266
- }
1265
+ };
1267
1266
  }
1268
1267
 
1269
1268
  asFoldingRanges(items: undefined | null): undefined | null;
1270
1269
  asFoldingRanges(items: FoldingRange[]): monaco.languages.FoldingRange[];
1271
- asFoldingRanges(items: FoldingRange[] | undefined | null): monaco.languages.FoldingRange[] | undefined | null {
1270
+ asFoldingRanges (items: FoldingRange[] | undefined | null): monaco.languages.FoldingRange[] | undefined | null {
1272
1271
  if (!items) {
1273
1272
  return items;
1274
1273
  }
1275
1274
  return items.map(item => this.asFoldingRange(item));
1276
1275
  }
1277
1276
 
1278
- asFoldingRange(item: FoldingRange): monaco.languages.FoldingRange {
1277
+ asFoldingRange (item: FoldingRange): monaco.languages.FoldingRange {
1279
1278
  return {
1280
1279
  start: item.startLine + 1,
1281
1280
  end: item.endLine + 1,
@@ -1283,7 +1282,7 @@ export class ProtocolToMonacoConverter {
1283
1282
  };
1284
1283
  }
1285
1284
 
1286
- asFoldingRangeKind(kind?: string): monaco.languages.FoldingRangeKind | undefined {
1285
+ asFoldingRangeKind (kind?: string): monaco.languages.FoldingRangeKind | undefined {
1287
1286
  if (kind) {
1288
1287
  switch (kind) {
1289
1288
  case FoldingRangeKind.Comment:
@@ -1292,35 +1291,35 @@ export class ProtocolToMonacoConverter {
1292
1291
  return this._monaco.languages.FoldingRangeKind.Imports;
1293
1292
  case FoldingRangeKind.Region:
1294
1293
  return this._monaco.languages.FoldingRangeKind.Region;
1295
- };
1294
+ }
1296
1295
  }
1297
1296
  return undefined;
1298
1297
  }
1299
1298
 
1300
- asSemanticTokens(semanticTokens: SemanticTokens): monaco.languages.SemanticTokens {
1299
+ asSemanticTokens (semanticTokens: SemanticTokens): monaco.languages.SemanticTokens {
1301
1300
  return {
1302
1301
  resultId: semanticTokens.resultId,
1303
1302
  data: Uint32Array.from(semanticTokens.data)
1304
- }
1303
+ };
1305
1304
  }
1306
1305
 
1307
- asInlayHintLabelPart(part: InlayHintLabelPart): monaco.languages.InlayHintLabelPart {
1306
+ asInlayHintLabelPart (part: InlayHintLabelPart): monaco.languages.InlayHintLabelPart {
1308
1307
  return {
1309
1308
  label: part.value,
1310
1309
  command: this.asCommand(part.command),
1311
1310
  location: this.asLocation(part.location),
1312
1311
  tooltip: part.tooltip && this.asMarkdownString(part.tooltip)
1313
- }
1312
+ };
1314
1313
  }
1315
1314
 
1316
- asInlayHintLabel(label: string | InlayHintLabelPart[]): string | monaco.languages.InlayHintLabelPart[] {
1315
+ asInlayHintLabel (label: string | InlayHintLabelPart[]): string | monaco.languages.InlayHintLabelPart[] {
1317
1316
  if (Array.isArray(label)) {
1318
- return label.map(part => this.asInlayHintLabelPart(part))
1317
+ return label.map(part => this.asInlayHintLabelPart(part));
1319
1318
  }
1320
- return label
1319
+ return label;
1321
1320
  }
1322
1321
 
1323
- asInlayHint(inlayHint: InlayHint): ProtocolInlayHint {
1322
+ asInlayHint (inlayHint: InlayHint): ProtocolInlayHint {
1324
1323
  return {
1325
1324
  data: inlayHint.data,
1326
1325
  label: this.asInlayHintLabel(inlayHint.label),
@@ -1329,13 +1328,13 @@ export class ProtocolToMonacoConverter {
1329
1328
  paddingLeft: inlayHint.paddingLeft,
1330
1329
  paddingRight: inlayHint.paddingRight,
1331
1330
  tooltip: inlayHint.tooltip && this.asMarkdownString(inlayHint.tooltip)
1332
- }
1331
+ };
1333
1332
  }
1334
1333
 
1335
1334
  asInlayHintList(items: InlayHint[]): monaco.languages.InlayHintList;
1336
1335
  asInlayHintList(items: undefined | null): undefined;
1337
1336
  asInlayHintList(items: InlayHint[] | undefined | null): monaco.languages.InlayHintList | undefined;
1338
- asInlayHintList(items: InlayHint[] | undefined | null): monaco.languages.InlayHintList | undefined {
1337
+ asInlayHintList (items: InlayHint[] | undefined | null): monaco.languages.InlayHintList | undefined {
1339
1338
  if (!items) {
1340
1339
  return undefined;
1341
1340
  }
@@ -1344,5 +1343,4 @@ export class ProtocolToMonacoConverter {
1344
1343
  dispose: () => { }
1345
1344
  };
1346
1345
  }
1347
-
1348
1346
  }