@@ -149,7 +149,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
149149 private handlers : vscode . Disposable [ ] = [ ] ;
150150 private extensionCommands : IExtensionCommand [ ] = [ ] ;
151151
152- constructor ( private log : Logger ) {
152+ constructor ( private logger : Logger ) {
153153 super ( ) ;
154154 this . commands = [
155155 vscode . commands . registerCommand ( "PowerShell.ShowAdditionalCommands" , async ( ) => {
@@ -216,7 +216,6 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
216216
217217 this . languageClient . onRequest (
218218 InsertTextRequestType ,
219- // eslint-disable-next-line @typescript-eslint/no-floating-promises
220219 ( details ) => this . insertText ( details ) ) ,
221220
222221 this . languageClient . onRequest (
@@ -262,8 +261,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
262261 // We check to see if they have TrueClear on. If not, no-op because the
263262 // overriden Clear-Host already calls [System.Console]::Clear()
264263 if ( Settings . load ( ) . integratedConsole . forceClearScrollbackBuffer ) {
265- // eslint-disable-next-line @typescript-eslint/no-floating-promises
266- vscode . commands . executeCommand ( "workbench.action.terminal.clear" ) ;
264+ void vscode . commands . executeCommand ( "workbench.action.terminal.clear" ) ;
267265 }
268266 } )
269267 ] ;
@@ -292,7 +290,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
292290 private async showExtensionCommands ( client : LanguageClient ) : Promise < void > {
293291 // If no extension commands are available, show a message
294292 if ( this . extensionCommands . length === 0 ) {
295- await vscode . window . showInformationMessage ( "No extension commands have been loaded into the current session." ) ;
293+ void this . logger . writeAndShowInformation ( "No extension commands have been loaded into the current session." ) ;
296294 return ;
297295 }
298296
@@ -364,10 +362,10 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
364362 } ;
365363 }
366364
367- private newFile ( ) : Thenable < EditorOperationResponse > {
368- return vscode . workspace . openTextDocument ( { content : "" } )
369- . then ( ( doc ) => vscode . window . showTextDocument ( doc ) )
370- . then ( ( _ ) => EditorOperationResponse . Completed ) ;
365+ private async newFile ( ) : Promise < EditorOperationResponse > {
366+ const doc = await vscode . workspace . openTextDocument ( { content : "" } ) ;
367+ await vscode . window . showTextDocument ( doc ) ;
368+ return EditorOperationResponse . Completed ;
371369 }
372370
373371 private openFile ( openFileDetails : IOpenFileDetails ) : Thenable < EditorOperationResponse > {
@@ -416,7 +414,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
416414 case "file" : {
417415 // If the file to save can't be found, just complete the request
418416 if ( ! this . findTextDocument ( this . normalizeFilePath ( currentFileUri . fsPath ) ) ) {
419- await this . log . writeAndShowError ( `File to save not found: ${ currentFileUri . fsPath } .` ) ;
417+ void this . logger . writeAndShowError ( `File to save not found: ${ currentFileUri . fsPath } .` ) ;
420418 return EditorOperationResponse . Completed ;
421419 }
422420
@@ -443,8 +441,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
443441 if ( ! saveFileDetails . newPath ) {
444442 // TODO: Create a class handle vscode warnings and errors so we can warn easily
445443 // without logging
446- await this . log . writeAndShowWarning (
447- "Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead." ) ;
444+ void this . logger . writeAndShowWarning ( "Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead." ) ;
448445 return EditorOperationResponse . Completed ;
449446 }
450447
@@ -454,7 +451,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
454451 } else {
455452 // In fresh contexts, workspaceFolders is not defined...
456453 if ( ! vscode . workspace . workspaceFolders || vscode . workspace . workspaceFolders . length === 0 ) {
457- await this . log . writeAndShowWarning ( "Cannot save file to relative path: no workspaces are open. " +
454+ void this . logger . writeAndShowWarning ( "Cannot save file to relative path: no workspaces are open. " +
458455 "Try saving to an absolute path, or open a workspace." ) ;
459456 return EditorOperationResponse . Completed ;
460457 }
@@ -463,7 +460,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
463460 const workspaceRootUri = vscode . workspace . workspaceFolders [ 0 ] . uri ;
464461 // We don't support saving to a non-file URI-schemed workspace
465462 if ( workspaceRootUri . scheme !== "file" ) {
466- await this . log . writeAndShowWarning (
463+ void this . logger . writeAndShowWarning (
467464 "Cannot save untitled file to a relative path in an untitled workspace. " +
468465 "Try saving to an absolute path or opening a workspace folder." ) ;
469466 return EditorOperationResponse . Completed ;
@@ -475,7 +472,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
475472 default : {
476473 // Other URI schemes are not supported
477474 const msg = JSON . stringify ( saveFileDetails ) ;
478- this . log . writeVerbose (
475+ this . logger . writeVerbose (
479476 `<${ ExtensionCommandsFeature . name } >: Saving a document with scheme '${ currentFileUri . scheme } ' ` +
480477 `is currently unsupported. Message: '${ msg } '` ) ;
481478 return EditorOperationResponse . Completed ; }
@@ -503,7 +500,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
503500 vscode . Uri . file ( destinationAbsolutePath ) ,
504501 Buffer . from ( oldDocument . getText ( ) ) ) ;
505502 } catch ( e ) {
506- await this . log . writeAndShowWarning ( `<${ ExtensionCommandsFeature . name } >: ` +
503+ void this . logger . writeAndShowWarning ( `<${ ExtensionCommandsFeature . name } >: ` +
507504 `Unable to save file to path '${ destinationAbsolutePath } ': ${ e } ` ) ;
508505 return ;
509506 }
@@ -572,18 +569,18 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
572569 return EditorOperationResponse . Completed ;
573570 }
574571
575- private async showInformationMessage ( message : string ) : Promise < EditorOperationResponse > {
576- await vscode . window . showInformationMessage ( message ) ;
572+ private showInformationMessage ( message : string ) : EditorOperationResponse {
573+ void this . logger . writeAndShowInformation ( message ) ;
577574 return EditorOperationResponse . Completed ;
578575 }
579576
580- private async showErrorMessage ( message : string ) : Promise < EditorOperationResponse > {
581- await vscode . window . showErrorMessage ( message ) ;
577+ private showErrorMessage ( message : string ) : EditorOperationResponse {
578+ void this . logger . writeAndShowError ( message ) ;
582579 return EditorOperationResponse . Completed ;
583580 }
584581
585- private async showWarningMessage ( message : string ) : Promise < EditorOperationResponse > {
586- await vscode . window . showWarningMessage ( message ) ;
582+ private showWarningMessage ( message : string ) : EditorOperationResponse {
583+ void this . logger . writeAndShowWarning ( message ) ;
587584 return EditorOperationResponse . Completed ;
588585 }
589586
0 commit comments