Skip to content

Commit

Permalink
When having details for non modal, show more which shows modal... #12…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 16, 2021
1 parent b81e9c4 commit fbe6292
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1862,8 +1862,7 @@ declare module 'vscode' {
modal?: boolean;

/**
* Human-readable detail message that is rendered less prominent. _Note_ that detail
* is only shown for {@link MessageOptions.modal modal} messages.
* Human-readable detail message that is rendered less prominent.
*/
detail?: string;
}
Expand Down
10 changes: 8 additions & 2 deletions src/vs/workbench/api/browser/mainThreadMessageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape {
if (options.modal) {
return this._showModalMessage(severity, message, options.detail, commands, options.useCustom);
} else {
return this._showMessage(severity, message, commands, options.extension);
return this._showNotificationMessage(severity, message, options.detail, commands, options.extension);
}
}

private _showMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[], extension: IExtensionDescription | undefined): Promise<number | undefined> {
private _showNotificationMessage(severity: Severity, message: string, detail: string | undefined, commands: { title: string; isCloseAffordance: boolean; handle: number; }[], extension: IExtensionDescription | undefined): Promise<number | undefined> {

return new Promise<number | undefined>(resolve => {

Expand All @@ -66,6 +66,12 @@ export class MainThreadMessageService implements MainThreadMessageServiceShape {
primaryActions.push(new MessageItemAction('_extension_message_handle_' + command.handle, command.title, command.handle));
});

if (detail) {
primaryActions.push(new Action('more', nls.localize('details', "More"), undefined, true, () => {
this._showModalMessage(severity, message, detail, commands, false);
}));
}

let source: string | { label: string, id: string } | undefined;
if (extension) {
source = {
Expand Down

0 comments on commit fbe6292

Please sign in to comment.