@@ -71,7 +71,7 @@ export class LanguageClientConnection extends EventEmitter {
71
71
* @param params The {InitializeParams} containing processId, rootPath, options and server capabilities.
72
72
* @returns A {Promise} containing the {InitializeResult} with details of the server's capabilities.
73
73
*/
74
- public initialize ( params : lsp . InitializeParams ) {
74
+ public initialize ( params : lsp . InitializeParams ) : Promise < lsp . InitializeResult > {
75
75
return this . _sendRequest ( lsp . InitializeRequest . type , params )
76
76
}
77
77
@@ -81,7 +81,7 @@ export class LanguageClientConnection extends EventEmitter {
81
81
}
82
82
83
83
/** Public: Send a `shutdown` request to the language server. */
84
- public shutdown ( ) {
84
+ public shutdown ( ) : Promise < void > {
85
85
return this . _sendRequest ( lsp . ShutdownRequest . type )
86
86
}
87
87
@@ -126,7 +126,7 @@ export class LanguageClientConnection extends EventEmitter {
126
126
* @param method A string containing the name of the request message.
127
127
* @param params The method's parameters
128
128
*/
129
- public sendCustomRequest ( method : string , params ?: any [ ] | object ) {
129
+ public sendCustomRequest ( method : string , params ?: any [ ] | object ) : Promise < any > {
130
130
return this . _sendRequest ( new lsp . ProtocolRequestType < typeof params , any , any , void , any > ( method ) , params )
131
131
}
132
132
@@ -258,7 +258,7 @@ export class LanguageClientConnection extends EventEmitter {
258
258
* @param params The {WillSaveTextDocumentParams} containing the to-be-saved text document details and the reason for the save.
259
259
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the text document before it is saved.
260
260
*/
261
- public willSaveWaitUntilTextDocument ( params : lsp . WillSaveTextDocumentParams ) {
261
+ public willSaveWaitUntilTextDocument ( params : lsp . WillSaveTextDocumentParams ) : Promise < lsp . TextEdit [ ] | null > {
262
262
return this . _sendRequest ( lsp . WillSaveTextDocumentWaitUntilRequest . type , params )
263
263
}
264
264
@@ -301,7 +301,7 @@ export class LanguageClientConnection extends EventEmitter {
301
301
public completion (
302
302
params : lsp . TextDocumentPositionParams | CompletionParams ,
303
303
cancellationToken ?: jsonrpc . CancellationToken
304
- ) {
304
+ ) : Promise < lsp . CompletionItem [ ] | lsp . CompletionList | null > {
305
305
// Cancel prior request if necessary
306
306
return this . _sendRequest ( lsp . CompletionRequest . type , params , cancellationToken )
307
307
}
@@ -312,7 +312,7 @@ export class LanguageClientConnection extends EventEmitter {
312
312
* @param params The {CompletionItem} for which a fully resolved {CompletionItem} is desired.
313
313
* @returns A {Promise} containing a fully resolved {CompletionItem}.
314
314
*/
315
- public completionItemResolve ( params : lsp . CompletionItem ) {
315
+ public completionItemResolve ( params : lsp . CompletionItem ) : Promise < lsp . CompletionItem > {
316
316
return this . _sendRequest ( lsp . CompletionResolveRequest . type , params )
317
317
}
318
318
@@ -322,7 +322,7 @@ export class LanguageClientConnection extends EventEmitter {
322
322
* @param params The {TextDocumentPositionParams} for which a {Hover} is desired.
323
323
* @returns A {Promise} containing a {Hover}.
324
324
*/
325
- public hover ( params : lsp . TextDocumentPositionParams ) {
325
+ public hover ( params : lsp . TextDocumentPositionParams ) : Promise < lsp . Hover | null > {
326
326
return this . _sendRequest ( lsp . HoverRequest . type , params )
327
327
}
328
328
@@ -332,7 +332,7 @@ export class LanguageClientConnection extends EventEmitter {
332
332
* @param params The {TextDocumentPositionParams} for which a {SignatureHelp} is desired.
333
333
* @returns A {Promise} containing a {SignatureHelp}.
334
334
*/
335
- public signatureHelp ( params : lsp . TextDocumentPositionParams ) {
335
+ public signatureHelp ( params : lsp . TextDocumentPositionParams ) : Promise < lsp . SignatureHelp | null > {
336
336
return this . _sendRequest ( lsp . SignatureHelpRequest . type , params )
337
337
}
338
338
@@ -343,7 +343,9 @@ export class LanguageClientConnection extends EventEmitter {
343
343
* symbol are required.
344
344
* @returns A {Promise} containing either a single {Location} or an {Array} of many {Location}s.
345
345
*/
346
- public gotoDefinition ( params : lsp . TextDocumentPositionParams ) {
346
+ public gotoDefinition (
347
+ params : lsp . TextDocumentPositionParams
348
+ ) : Promise < lsp . Location | lsp . Location [ ] | lsp . LocationLink [ ] | null > {
347
349
return this . _sendRequest ( lsp . DefinitionRequest . type , params )
348
350
}
349
351
@@ -353,7 +355,7 @@ export class LanguageClientConnection extends EventEmitter {
353
355
* @param params The {TextDocumentPositionParams} of a symbol for which all referring {Location}s are desired.
354
356
* @returns A {Promise} containing an {Array} of {Location}s that reference this symbol.
355
357
*/
356
- public findReferences ( params : lsp . ReferenceParams ) {
358
+ public findReferences ( params : lsp . ReferenceParams ) : Promise < lsp . Location [ ] | null > {
357
359
return this . _sendRequest ( lsp . ReferencesRequest . type , params )
358
360
}
359
361
@@ -363,7 +365,7 @@ export class LanguageClientConnection extends EventEmitter {
363
365
* @param params The {TextDocumentPositionParams} of a symbol for which all highlights are desired.
364
366
* @returns A {Promise} containing an {Array} of {DocumentHighlight}s that can be used to highlight this symbol.
365
367
*/
366
- public documentHighlight ( params : lsp . TextDocumentPositionParams ) {
368
+ public documentHighlight ( params : lsp . TextDocumentPositionParams ) : Promise < lsp . DocumentHighlight [ ] | null > {
367
369
return this . _sendRequest ( lsp . DocumentHighlightRequest . type , params )
368
370
}
369
371
@@ -374,7 +376,10 @@ export class LanguageClientConnection extends EventEmitter {
374
376
* @param cancellationToken The {CancellationToken} that is used to cancel this request if necessary.
375
377
* @returns A {Promise} containing an {Array} of {SymbolInformation}s that can be used to navigate this document.
376
378
*/
377
- public documentSymbol ( params : lsp . DocumentSymbolParams , _cancellationToken ?: jsonrpc . CancellationToken ) {
379
+ public documentSymbol (
380
+ params : lsp . DocumentSymbolParams ,
381
+ _cancellationToken ?: jsonrpc . CancellationToken
382
+ ) : Promise < lsp . SymbolInformation [ ] | lsp . DocumentSymbol [ ] | null > {
378
383
return this . _sendRequest ( lsp . DocumentSymbolRequest . type , params )
379
384
}
380
385
@@ -385,7 +390,7 @@ export class LanguageClientConnection extends EventEmitter {
385
390
* @returns A {Promise} containing an {Array} of {SymbolInformation}s that identify where the query string occurs
386
391
* within the workspace.
387
392
*/
388
- public workspaceSymbol ( params : lsp . WorkspaceSymbolParams ) {
393
+ public workspaceSymbol ( params : lsp . WorkspaceSymbolParams ) : Promise < lsp . SymbolInformation [ ] | null > {
389
394
return this . _sendRequest ( lsp . WorkspaceSymbolRequest . type , params )
390
395
}
391
396
@@ -395,7 +400,7 @@ export class LanguageClientConnection extends EventEmitter {
395
400
* @param params The {CodeActionParams} identifying the document, range and context for the code action.
396
401
* @returns A {Promise} containing an {Array} of {Commands}s that can be performed against the given documents range.
397
402
*/
398
- public codeAction ( params : lsp . CodeActionParams ) {
403
+ public codeAction ( params : lsp . CodeActionParams ) : Promise < Array < lsp . Command | lsp . CodeAction > | null > {
399
404
return this . _sendRequest ( lsp . CodeActionRequest . type , params )
400
405
}
401
406
@@ -406,7 +411,7 @@ export class LanguageClientConnection extends EventEmitter {
406
411
* @returns A {Promise} containing an {Array} of {CodeLens}s that associate commands and data with specified ranges
407
412
* within the document.
408
413
*/
409
- public codeLens ( params : lsp . CodeLensParams ) {
414
+ public codeLens ( params : lsp . CodeLensParams ) : Promise < lsp . CodeLens [ ] | null > {
410
415
return this . _sendRequest ( lsp . CodeLensRequest . type , params )
411
416
}
412
417
@@ -416,7 +421,7 @@ export class LanguageClientConnection extends EventEmitter {
416
421
* @param params The {CodeLens} identifying the code lens to be resolved with full detail.
417
422
* @returns A {Promise} containing the {CodeLens} fully resolved.
418
423
*/
419
- public codeLensResolve ( params : lsp . CodeLens ) {
424
+ public codeLensResolve ( params : lsp . CodeLens ) : Promise < lsp . CodeLens > {
420
425
return this . _sendRequest ( lsp . CodeLensResolveRequest . type , params )
421
426
}
422
427
@@ -426,7 +431,7 @@ export class LanguageClientConnection extends EventEmitter {
426
431
* @param params The {DocumentLinkParams} identifying the document for which links should be identified.
427
432
* @returns A {Promise} containing an {Array} of {DocumentLink}s relating uri's to specific ranges within the document.
428
433
*/
429
- public documentLink ( params : lsp . DocumentLinkParams ) {
434
+ public documentLink ( params : lsp . DocumentLinkParams ) : Promise < lsp . DocumentLink [ ] | null > {
430
435
return this . _sendRequest ( lsp . DocumentLinkRequest . type , params )
431
436
}
432
437
@@ -436,7 +441,7 @@ export class LanguageClientConnection extends EventEmitter {
436
441
* @param params The {DocumentLink} identifying the document link to be resolved with full detail.
437
442
* @returns A {Promise} containing the {DocumentLink} fully resolved.
438
443
*/
439
- public documentLinkResolve ( params : lsp . DocumentLink ) {
444
+ public documentLinkResolve ( params : lsp . DocumentLink ) : Promise < lsp . DocumentLink > {
440
445
return this . _sendRequest ( lsp . DocumentLinkResolveRequest . type , params )
441
446
}
442
447
@@ -447,7 +452,7 @@ export class LanguageClientConnection extends EventEmitter {
447
452
* formatting preferences.
448
453
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
449
454
*/
450
- public documentFormatting ( params : lsp . DocumentFormattingParams ) {
455
+ public documentFormatting ( params : lsp . DocumentFormattingParams ) : Promise < lsp . TextEdit [ ] | null > {
451
456
return this . _sendRequest ( lsp . DocumentFormattingRequest . type , params )
452
457
}
453
458
@@ -458,7 +463,7 @@ export class LanguageClientConnection extends EventEmitter {
458
463
* additional formatting preferences.
459
464
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
460
465
*/
461
- public documentRangeFormatting ( params : lsp . DocumentRangeFormattingParams ) {
466
+ public documentRangeFormatting ( params : lsp . DocumentRangeFormattingParams ) : Promise < lsp . TextEdit [ ] | null > {
462
467
return this . _sendRequest ( lsp . DocumentRangeFormattingRequest . type , params )
463
468
}
464
469
@@ -469,7 +474,7 @@ export class LanguageClientConnection extends EventEmitter {
469
474
* typed and at what position as well as additional formatting preferences.
470
475
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
471
476
*/
472
- public documentOnTypeFormatting ( params : lsp . DocumentOnTypeFormattingParams ) {
477
+ public documentOnTypeFormatting ( params : lsp . DocumentOnTypeFormattingParams ) : Promise < lsp . TextEdit [ ] | null > {
473
478
return this . _sendRequest ( lsp . DocumentOnTypeFormattingRequest . type , params )
474
479
}
475
480
@@ -481,7 +486,7 @@ export class LanguageClientConnection extends EventEmitter {
481
486
* @returns A {Promise} containing an {WorkspaceEdit} that contains a list of {TextEdit}s either on the changes
482
487
* property (keyed by uri) or the documentChanges property containing an {Array} of {TextDocumentEdit}s (preferred).
483
488
*/
484
- public rename ( params : lsp . RenameParams ) {
489
+ public rename ( params : lsp . RenameParams ) : Promise < lsp . WorkspaceEdit | null > {
485
490
return this . _sendRequest ( lsp . RenameRequest . type , params )
486
491
}
487
492
@@ -492,7 +497,7 @@ export class LanguageClientConnection extends EventEmitter {
492
497
* (these commands are usually from {CodeLens} or {CodeAction} responses).
493
498
* @returns A {Promise} containing anything.
494
499
*/
495
- public executeCommand ( params : lsp . ExecuteCommandParams ) {
500
+ public executeCommand ( params : lsp . ExecuteCommandParams ) : Promise < any > {
496
501
return this . _sendRequest ( lsp . ExecuteCommandRequest . type , params )
497
502
}
498
503
0 commit comments