Change service installation messages to not steal focus (#6227)

* Change service installation messages to not steal focus

* Undo unnecessary changes to localized strings in serviceClient.ts

* Add default case for missing server event types
This commit is contained in:
Charles Gagnon
2019-07-01 22:11:14 +00:00
committed by GitHub
parent 7f5e00fd81
commit 8b349dbcde
2 changed files with 16 additions and 12 deletions

View File

@@ -109,10 +109,10 @@ export class ServiceClient {
private generateHandleServerProviderEvent(): EventAndListener { private generateHandleServerProviderEvent(): EventAndListener {
let dots = 0; let dots = 0;
return (e: string, ...args: any[]) => { return (e: string, ...args: any[]) => {
this.outputChannel.show();
this.statusView.show();
switch (e) { switch (e) {
case Events.INSTALL_START: case Events.INSTALL_START:
this.outputChannel.show(true);
this.statusView.show();
this.outputChannel.appendLine(localize('installingServiceDetailed', 'Installing {0} service to {1}', Constants.serviceName, args[0])); this.outputChannel.appendLine(localize('installingServiceDetailed', 'Installing {0} service to {1}', Constants.serviceName, args[0]));
this.statusView.text = localize('installingService', 'Installing Service'); this.statusView.text = localize('installingService', 'Installing Service');
break; break;
@@ -121,7 +121,7 @@ export class ServiceClient {
break; break;
case Events.DOWNLOAD_START: case Events.DOWNLOAD_START:
this.outputChannel.appendLine(localize('downloadingService', 'Downloading {0}', args[0])); this.outputChannel.appendLine(localize('downloadingService', 'Downloading {0}', args[0]));
this.outputChannel.append(`(${Math.ceil(args[1] / 1024)} KB)`); this.outputChannel.append(localize('downloadingServiceSize', '({0} KB)', Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language)));
this.statusView.text = localize('downloadingServiceStatus', 'Downloading Service'); this.statusView.text = localize('downloadingServiceStatus', 'Downloading Service');
break; break;
case Events.DOWNLOAD_PROGRESS: case Events.DOWNLOAD_PROGRESS:
@@ -135,6 +135,7 @@ export class ServiceClient {
this.outputChannel.appendLine(localize('downloadingServiceComplete', 'Done!')); this.outputChannel.appendLine(localize('downloadingServiceComplete', 'Done!'));
break; break;
default: default:
console.error(`Unknown event from Server Provider ${e}`);
break; break;
} }
}; };

View File

@@ -362,20 +362,20 @@ function generateServerOptions(executablePath: string): ServerOptions {
function generateHandleServerProviderEvent() { function generateHandleServerProviderEvent() {
let dots = 0; let dots = 0;
return (e: string, ...args: any[]) => { return (e: string, ...args: any[]) => {
outputChannel.show();
statusView.show();
switch (e) { switch (e) {
case Events.INSTALL_START: case Events.INSTALL_START:
outputChannel.appendLine(`Installing ${Constants.serviceName} service to ${args[0]}`); outputChannel.show(true);
statusView.text = 'Installing Service'; statusView.show();
outputChannel.appendLine(localize('installingServiceChannelMsg', 'Installing {0} service to {1}', Constants.serviceName, args[0]));
statusView.text = localize('installingServiceStatusMsg', 'Installing Service');
break; break;
case Events.INSTALL_END: case Events.INSTALL_END:
outputChannel.appendLine('Installed'); outputChannel.appendLine(localize('installedServiceChannelMsg', 'Installed'));
break; break;
case Events.DOWNLOAD_START: case Events.DOWNLOAD_START:
outputChannel.appendLine(`Downloading ${args[0]}`); outputChannel.appendLine(localize('downloadingServiceChannelMsg', 'Downloading {0}', args[0]));
outputChannel.append(`(${Math.ceil(args[1] / 1024)} KB)`); outputChannel.append(localize('downloadingServiceSizeChannelMsg', '({0} KB)', Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language)));
statusView.text = 'Downloading Service'; statusView.text = localize('downloadingServiceStatusMsg', 'Downloading Service');
break; break;
case Events.DOWNLOAD_PROGRESS: case Events.DOWNLOAD_PROGRESS:
let newDots = Math.ceil(args[0] / 5); let newDots = Math.ceil(args[0] / 5);
@@ -385,7 +385,10 @@ function generateHandleServerProviderEvent() {
} }
break; break;
case Events.DOWNLOAD_END: case Events.DOWNLOAD_END:
outputChannel.appendLine('Done!'); outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', 'Done!'));
break;
default:
console.error(`Unknown event from Server Provider ${e}`);
break; break;
} }
}; };