Merge from vscode 5b9869eb02fa4c96205a74d05cad9164dfd06d60 (#5607)

This commit is contained in:
Anthony Dresser
2019-05-24 12:20:30 -07:00
committed by GitHub
parent 361ada4963
commit bcc449b524
126 changed files with 3096 additions and 2255 deletions

View File

@@ -78,17 +78,16 @@ class NativeDialogService implements IDialogService {
sharedProcessService.registerChannel('dialog', new DialogChannel(this));
}
confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
async confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
this.logService.trace('DialogService#confirm', confirmation.message);
const { options, buttonIndexMap } = this.massageMessageBoxOptions(this.getConfirmOptions(confirmation));
return this.windowService.showMessageBox(options).then(result => {
return {
confirmed: buttonIndexMap[result.button] === 0 ? true : false,
checkboxChecked: result.checkboxChecked
};
});
const result = await this.windowService.showMessageBox(options);
return {
confirmed: buttonIndexMap[result.button] === 0 ? true : false,
checkboxChecked: result.checkboxChecked
};
}
private getConfirmOptions(confirmation: IConfirmation): Electron.MessageBoxOptions {
@@ -128,7 +127,7 @@ class NativeDialogService implements IDialogService {
return opts;
}
show(severity: Severity, message: string, buttons: string[], dialogOptions?: IDialogOptions): Promise<number> {
async show(severity: Severity, message: string, buttons: string[], dialogOptions?: IDialogOptions): Promise<number> {
this.logService.trace('DialogService#show', message);
const { options, buttonIndexMap } = this.massageMessageBoxOptions({
@@ -139,7 +138,8 @@ class NativeDialogService implements IDialogService {
detail: dialogOptions ? dialogOptions.detail : undefined
});
return this.windowService.showMessageBox(options).then(result => buttonIndexMap[result.button]);
const result = await this.windowService.showMessageBox(options);
return buttonIndexMap[result.button];
}
private massageMessageBoxOptions(options: Electron.MessageBoxOptions): IMassagedMessageBoxOptions {