This commit is contained in:
Johannes Rieken
2021-06-15 11:40:55 +02:00
parent a02815e61b
commit 505dfc7a06
4 changed files with 13 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape {
$showMessage(severity: Severity, message: string, options: MainThreadMessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Promise<number | undefined> {
if (options.modal) {
return this._showModalMessage(severity, message, commands, options.useCustom);
return this._showModalMessage(severity, message, options.detail, commands, options.useCustom);
} else {
return this._showMessage(severity, message, commands, options.extension);
}
@@ -100,7 +100,7 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape {
});
}
private async _showModalMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[], useCustom?: boolean): Promise<number | undefined> {
private async _showModalMessage(severity: Severity, message: string, detail: string | undefined, commands: { title: string; isCloseAffordance: boolean; handle: number; }[], useCustom?: boolean): Promise<number | undefined> {
let cancelId: number | undefined = undefined;
const buttons = commands.map((command, index) => {
@@ -121,7 +121,7 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape {
cancelId = buttons.length - 1;
}
const { choice } = await this._dialogService.show(severity, message, buttons, { cancelId, custom: useCustom });
const { choice } = await this._dialogService.show(severity, message, buttons, { cancelId, custom: useCustom, detail });
return choice === commands.length ? undefined : commands[choice].handle;
}
}

View File

@@ -423,6 +423,7 @@ export interface MainThreadLanguagesShape extends IDisposable {
export interface MainThreadMessageOptions {
extension?: IExtensionDescription;
modal?: boolean;
detail?: string;
useCustom?: boolean;
}

View File

@@ -37,8 +37,9 @@ export class ExtHostMessageService {
if (typeof optionsOrFirstItem === 'string' || isMessageItem(optionsOrFirstItem)) {
items = [optionsOrFirstItem, ...rest];
} else {
options.modal = optionsOrFirstItem && optionsOrFirstItem.modal;
options.useCustom = optionsOrFirstItem && optionsOrFirstItem.useCustom;
options.modal = optionsOrFirstItem?.modal;
options.useCustom = optionsOrFirstItem?.useCustom;
options.detail = optionsOrFirstItem?.detail;
items = rest;
}