@@ -149,7 +149,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
149
149
private handlers : vscode . Disposable [ ] = [ ] ;
150
150
private extensionCommands : IExtensionCommand [ ] = [ ] ;
151
151
152
- constructor ( private log : Logger ) {
152
+ constructor ( private logger : Logger ) {
153
153
super ( ) ;
154
154
this . commands = [
155
155
vscode . commands . registerCommand ( "PowerShell.ShowAdditionalCommands" , async ( ) => {
@@ -216,7 +216,6 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
216
216
217
217
this . languageClient . onRequest (
218
218
InsertTextRequestType ,
219
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
220
219
( details ) => this . insertText ( details ) ) ,
221
220
222
221
this . languageClient . onRequest (
@@ -262,8 +261,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
262
261
// We check to see if they have TrueClear on. If not, no-op because the
263
262
// overriden Clear-Host already calls [System.Console]::Clear()
264
263
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" ) ;
267
265
}
268
266
} )
269
267
] ;
@@ -292,7 +290,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
292
290
private async showExtensionCommands ( client : LanguageClient ) : Promise < void > {
293
291
// If no extension commands are available, show a message
294
292
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." ) ;
296
294
return ;
297
295
}
298
296
@@ -364,10 +362,10 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
364
362
} ;
365
363
}
366
364
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 ;
371
369
}
372
370
373
371
private openFile ( openFileDetails : IOpenFileDetails ) : Thenable < EditorOperationResponse > {
@@ -416,7 +414,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
416
414
case "file" : {
417
415
// If the file to save can't be found, just complete the request
418
416
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 } .` ) ;
420
418
return EditorOperationResponse . Completed ;
421
419
}
422
420
@@ -443,8 +441,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
443
441
if ( ! saveFileDetails . newPath ) {
444
442
// TODO: Create a class handle vscode warnings and errors so we can warn easily
445
443
// 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." ) ;
448
445
return EditorOperationResponse . Completed ;
449
446
}
450
447
@@ -454,7 +451,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
454
451
} else {
455
452
// In fresh contexts, workspaceFolders is not defined...
456
453
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. " +
458
455
"Try saving to an absolute path, or open a workspace." ) ;
459
456
return EditorOperationResponse . Completed ;
460
457
}
@@ -463,7 +460,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
463
460
const workspaceRootUri = vscode . workspace . workspaceFolders [ 0 ] . uri ;
464
461
// We don't support saving to a non-file URI-schemed workspace
465
462
if ( workspaceRootUri . scheme !== "file" ) {
466
- await this . log . writeAndShowWarning (
463
+ void this . logger . writeAndShowWarning (
467
464
"Cannot save untitled file to a relative path in an untitled workspace. " +
468
465
"Try saving to an absolute path or opening a workspace folder." ) ;
469
466
return EditorOperationResponse . Completed ;
@@ -475,7 +472,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
475
472
default : {
476
473
// Other URI schemes are not supported
477
474
const msg = JSON . stringify ( saveFileDetails ) ;
478
- this . log . writeVerbose (
475
+ this . logger . writeVerbose (
479
476
`<${ ExtensionCommandsFeature . name } >: Saving a document with scheme '${ currentFileUri . scheme } ' ` +
480
477
`is currently unsupported. Message: '${ msg } '` ) ;
481
478
return EditorOperationResponse . Completed ; }
@@ -503,7 +500,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
503
500
vscode . Uri . file ( destinationAbsolutePath ) ,
504
501
Buffer . from ( oldDocument . getText ( ) ) ) ;
505
502
} catch ( e ) {
506
- await this . log . writeAndShowWarning ( `<${ ExtensionCommandsFeature . name } >: ` +
503
+ void this . logger . writeAndShowWarning ( `<${ ExtensionCommandsFeature . name } >: ` +
507
504
`Unable to save file to path '${ destinationAbsolutePath } ': ${ e } ` ) ;
508
505
return ;
509
506
}
@@ -572,18 +569,18 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer {
572
569
return EditorOperationResponse . Completed ;
573
570
}
574
571
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 ) ;
577
574
return EditorOperationResponse . Completed ;
578
575
}
579
576
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 ) ;
582
579
return EditorOperationResponse . Completed ;
583
580
}
584
581
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 ) ;
587
584
return EditorOperationResponse . Completed ;
588
585
}
589
586
0 commit comments