Skip to content

Commit d665159

Browse files
committed
fix: lint(Missing return type on function)
1 parent c9876c6 commit d665159

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

lib/languageclient.ts

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class LanguageClientConnection extends EventEmitter {
7171
* @param params The {InitializeParams} containing processId, rootPath, options and server capabilities.
7272
* @returns A {Promise} containing the {InitializeResult} with details of the server's capabilities.
7373
*/
74-
public initialize(params: lsp.InitializeParams) {
74+
public initialize(params: lsp.InitializeParams): Promise<lsp.InitializeResult> {
7575
return this._sendRequest(lsp.InitializeRequest.type, params)
7676
}
7777

@@ -81,7 +81,7 @@ export class LanguageClientConnection extends EventEmitter {
8181
}
8282

8383
/** Public: Send a `shutdown` request to the language server. */
84-
public shutdown() {
84+
public shutdown(): Promise<void> {
8585
return this._sendRequest(lsp.ShutdownRequest.type)
8686
}
8787

@@ -126,7 +126,7 @@ export class LanguageClientConnection extends EventEmitter {
126126
* @param method A string containing the name of the request message.
127127
* @param params The method's parameters
128128
*/
129-
public sendCustomRequest(method: string, params?: any[] | object) {
129+
public sendCustomRequest(method: string, params?: any[] | object): Promise<any> {
130130
return this._sendRequest(new lsp.ProtocolRequestType<typeof params, any, any, void, any>(method), params)
131131
}
132132

@@ -258,7 +258,7 @@ export class LanguageClientConnection extends EventEmitter {
258258
* @param params The {WillSaveTextDocumentParams} containing the to-be-saved text document details and the reason for the save.
259259
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the text document before it is saved.
260260
*/
261-
public willSaveWaitUntilTextDocument(params: lsp.WillSaveTextDocumentParams) {
261+
public willSaveWaitUntilTextDocument(params: lsp.WillSaveTextDocumentParams): Promise<lsp.TextEdit[] | null> {
262262
return this._sendRequest(lsp.WillSaveTextDocumentWaitUntilRequest.type, params)
263263
}
264264

@@ -301,7 +301,7 @@ export class LanguageClientConnection extends EventEmitter {
301301
public completion(
302302
params: lsp.TextDocumentPositionParams | CompletionParams,
303303
cancellationToken?: jsonrpc.CancellationToken
304-
) {
304+
): Promise<lsp.CompletionItem[] | lsp.CompletionList | null> {
305305
// Cancel prior request if necessary
306306
return this._sendRequest(lsp.CompletionRequest.type, params, cancellationToken)
307307
}
@@ -312,7 +312,7 @@ export class LanguageClientConnection extends EventEmitter {
312312
* @param params The {CompletionItem} for which a fully resolved {CompletionItem} is desired.
313313
* @returns A {Promise} containing a fully resolved {CompletionItem}.
314314
*/
315-
public completionItemResolve(params: lsp.CompletionItem) {
315+
public completionItemResolve(params: lsp.CompletionItem): Promise<lsp.CompletionItem> {
316316
return this._sendRequest(lsp.CompletionResolveRequest.type, params)
317317
}
318318

@@ -322,7 +322,7 @@ export class LanguageClientConnection extends EventEmitter {
322322
* @param params The {TextDocumentPositionParams} for which a {Hover} is desired.
323323
* @returns A {Promise} containing a {Hover}.
324324
*/
325-
public hover(params: lsp.TextDocumentPositionParams) {
325+
public hover(params: lsp.TextDocumentPositionParams): Promise<lsp.Hover | null> {
326326
return this._sendRequest(lsp.HoverRequest.type, params)
327327
}
328328

@@ -332,7 +332,7 @@ export class LanguageClientConnection extends EventEmitter {
332332
* @param params The {TextDocumentPositionParams} for which a {SignatureHelp} is desired.
333333
* @returns A {Promise} containing a {SignatureHelp}.
334334
*/
335-
public signatureHelp(params: lsp.TextDocumentPositionParams) {
335+
public signatureHelp(params: lsp.TextDocumentPositionParams): Promise<lsp.SignatureHelp | null> {
336336
return this._sendRequest(lsp.SignatureHelpRequest.type, params)
337337
}
338338

@@ -343,7 +343,9 @@ export class LanguageClientConnection extends EventEmitter {
343343
* symbol are required.
344344
* @returns A {Promise} containing either a single {Location} or an {Array} of many {Location}s.
345345
*/
346-
public gotoDefinition(params: lsp.TextDocumentPositionParams) {
346+
public gotoDefinition(
347+
params: lsp.TextDocumentPositionParams
348+
): Promise<lsp.Location | lsp.Location[] | lsp.LocationLink[] | null> {
347349
return this._sendRequest(lsp.DefinitionRequest.type, params)
348350
}
349351

@@ -353,7 +355,7 @@ export class LanguageClientConnection extends EventEmitter {
353355
* @param params The {TextDocumentPositionParams} of a symbol for which all referring {Location}s are desired.
354356
* @returns A {Promise} containing an {Array} of {Location}s that reference this symbol.
355357
*/
356-
public findReferences(params: lsp.ReferenceParams) {
358+
public findReferences(params: lsp.ReferenceParams): Promise<lsp.Location[] | null> {
357359
return this._sendRequest(lsp.ReferencesRequest.type, params)
358360
}
359361

@@ -363,7 +365,7 @@ export class LanguageClientConnection extends EventEmitter {
363365
* @param params The {TextDocumentPositionParams} of a symbol for which all highlights are desired.
364366
* @returns A {Promise} containing an {Array} of {DocumentHighlight}s that can be used to highlight this symbol.
365367
*/
366-
public documentHighlight(params: lsp.TextDocumentPositionParams) {
368+
public documentHighlight(params: lsp.TextDocumentPositionParams): Promise<lsp.DocumentHighlight[] | null> {
367369
return this._sendRequest(lsp.DocumentHighlightRequest.type, params)
368370
}
369371

@@ -374,7 +376,10 @@ export class LanguageClientConnection extends EventEmitter {
374376
* @param cancellationToken The {CancellationToken} that is used to cancel this request if necessary.
375377
* @returns A {Promise} containing an {Array} of {SymbolInformation}s that can be used to navigate this document.
376378
*/
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> {
378383
return this._sendRequest(lsp.DocumentSymbolRequest.type, params)
379384
}
380385

@@ -385,7 +390,7 @@ export class LanguageClientConnection extends EventEmitter {
385390
* @returns A {Promise} containing an {Array} of {SymbolInformation}s that identify where the query string occurs
386391
* within the workspace.
387392
*/
388-
public workspaceSymbol(params: lsp.WorkspaceSymbolParams) {
393+
public workspaceSymbol(params: lsp.WorkspaceSymbolParams): Promise<lsp.SymbolInformation[] | null> {
389394
return this._sendRequest(lsp.WorkspaceSymbolRequest.type, params)
390395
}
391396

@@ -395,7 +400,7 @@ export class LanguageClientConnection extends EventEmitter {
395400
* @param params The {CodeActionParams} identifying the document, range and context for the code action.
396401
* @returns A {Promise} containing an {Array} of {Commands}s that can be performed against the given documents range.
397402
*/
398-
public codeAction(params: lsp.CodeActionParams) {
403+
public codeAction(params: lsp.CodeActionParams): Promise<Array<lsp.Command | lsp.CodeAction> | null> {
399404
return this._sendRequest(lsp.CodeActionRequest.type, params)
400405
}
401406

@@ -406,7 +411,7 @@ export class LanguageClientConnection extends EventEmitter {
406411
* @returns A {Promise} containing an {Array} of {CodeLens}s that associate commands and data with specified ranges
407412
* within the document.
408413
*/
409-
public codeLens(params: lsp.CodeLensParams) {
414+
public codeLens(params: lsp.CodeLensParams): Promise<lsp.CodeLens[] | null> {
410415
return this._sendRequest(lsp.CodeLensRequest.type, params)
411416
}
412417

@@ -416,7 +421,7 @@ export class LanguageClientConnection extends EventEmitter {
416421
* @param params The {CodeLens} identifying the code lens to be resolved with full detail.
417422
* @returns A {Promise} containing the {CodeLens} fully resolved.
418423
*/
419-
public codeLensResolve(params: lsp.CodeLens) {
424+
public codeLensResolve(params: lsp.CodeLens): Promise<lsp.CodeLens> {
420425
return this._sendRequest(lsp.CodeLensResolveRequest.type, params)
421426
}
422427

@@ -426,7 +431,7 @@ export class LanguageClientConnection extends EventEmitter {
426431
* @param params The {DocumentLinkParams} identifying the document for which links should be identified.
427432
* @returns A {Promise} containing an {Array} of {DocumentLink}s relating uri's to specific ranges within the document.
428433
*/
429-
public documentLink(params: lsp.DocumentLinkParams) {
434+
public documentLink(params: lsp.DocumentLinkParams): Promise<lsp.DocumentLink[] | null> {
430435
return this._sendRequest(lsp.DocumentLinkRequest.type, params)
431436
}
432437

@@ -436,7 +441,7 @@ export class LanguageClientConnection extends EventEmitter {
436441
* @param params The {DocumentLink} identifying the document link to be resolved with full detail.
437442
* @returns A {Promise} containing the {DocumentLink} fully resolved.
438443
*/
439-
public documentLinkResolve(params: lsp.DocumentLink) {
444+
public documentLinkResolve(params: lsp.DocumentLink): Promise<lsp.DocumentLink> {
440445
return this._sendRequest(lsp.DocumentLinkResolveRequest.type, params)
441446
}
442447

@@ -447,7 +452,7 @@ export class LanguageClientConnection extends EventEmitter {
447452
* formatting preferences.
448453
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
449454
*/
450-
public documentFormatting(params: lsp.DocumentFormattingParams) {
455+
public documentFormatting(params: lsp.DocumentFormattingParams): Promise<lsp.TextEdit[] | null> {
451456
return this._sendRequest(lsp.DocumentFormattingRequest.type, params)
452457
}
453458

@@ -458,7 +463,7 @@ export class LanguageClientConnection extends EventEmitter {
458463
* additional formatting preferences.
459464
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
460465
*/
461-
public documentRangeFormatting(params: lsp.DocumentRangeFormattingParams) {
466+
public documentRangeFormatting(params: lsp.DocumentRangeFormattingParams): Promise<lsp.TextEdit[] | null> {
462467
return this._sendRequest(lsp.DocumentRangeFormattingRequest.type, params)
463468
}
464469

@@ -469,7 +474,7 @@ export class LanguageClientConnection extends EventEmitter {
469474
* typed and at what position as well as additional formatting preferences.
470475
* @returns A {Promise} containing an {Array} of {TextEdit}s to be applied to the document to correctly reformat it.
471476
*/
472-
public documentOnTypeFormatting(params: lsp.DocumentOnTypeFormattingParams) {
477+
public documentOnTypeFormatting(params: lsp.DocumentOnTypeFormattingParams): Promise<lsp.TextEdit[] | null> {
473478
return this._sendRequest(lsp.DocumentOnTypeFormattingRequest.type, params)
474479
}
475480

@@ -481,7 +486,7 @@ export class LanguageClientConnection extends EventEmitter {
481486
* @returns A {Promise} containing an {WorkspaceEdit} that contains a list of {TextEdit}s either on the changes
482487
* property (keyed by uri) or the documentChanges property containing an {Array} of {TextDocumentEdit}s (preferred).
483488
*/
484-
public rename(params: lsp.RenameParams) {
489+
public rename(params: lsp.RenameParams): Promise<lsp.WorkspaceEdit | null> {
485490
return this._sendRequest(lsp.RenameRequest.type, params)
486491
}
487492

@@ -492,7 +497,7 @@ export class LanguageClientConnection extends EventEmitter {
492497
* (these commands are usually from {CodeLens} or {CodeAction} responses).
493498
* @returns A {Promise} containing anything.
494499
*/
495-
public executeCommand(params: lsp.ExecuteCommandParams) {
500+
public executeCommand(params: lsp.ExecuteCommandParams): Promise<any> {
496501
return this._sendRequest(lsp.ExecuteCommandRequest.type, params)
497502
}
498503

0 commit comments

Comments
 (0)