diff --git a/src/vs/platform/notification/common/notification.ts b/src/vs/platform/notification/common/notification.ts index c567c3de2de..487ed4484b6 100644 --- a/src/vs/platform/notification/common/notification.ts +++ b/src/vs/platform/notification/common/notification.ts @@ -35,12 +35,6 @@ export interface INotificationProperties { * such as future requests will not cause the notification to show again. */ readonly neverShowAgain?: INeverShowAgainOptions; - - /** - * Will be called if the user closed the notification without picking - * any of the provided choices. - */ - onCancel?: () => void; } export enum NeverShowAgainScope { @@ -253,6 +247,15 @@ export interface IPromptChoiceWithMenu extends IPromptChoice { readonly isSecondary: undefined; } +export interface IPromptOptions extends INotificationProperties { + + /** + * Will be called if the user closed the notification without picking + * any of the provided choices. + */ + onCancel?: () => void; +} + export interface IStatusMessageOptions { /** @@ -337,7 +340,7 @@ export interface INotificationService { * * @returns a handle on the notification to e.g. hide it or update message, buttons, etc. */ - prompt(severity: Severity, message: string, choices: (IPromptChoice | IPromptChoiceWithMenu)[], options?: INotificationProperties): INotificationHandle; + prompt(severity: Severity, message: string, choices: (IPromptChoice | IPromptChoiceWithMenu)[], options?: IPromptOptions): INotificationHandle; /** * Shows a status message in the status area with the provided text. diff --git a/src/vs/workbench/contrib/experiments/test/electron-browser/experimentalPrompts.test.ts b/src/vs/workbench/contrib/experiments/test/electron-browser/experimentalPrompts.test.ts index 54ef9377778..f2b4d57f7c3 100644 --- a/src/vs/workbench/contrib/experiments/test/electron-browser/experimentalPrompts.test.ts +++ b/src/vs/workbench/contrib/experiments/test/electron-browser/experimentalPrompts.test.ts @@ -7,7 +7,7 @@ import * as assert from 'assert'; import { Emitter } from 'vs/base/common/event'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle'; -import { INotificationService, IPromptChoice, INotificationProperties, Severity } from 'vs/platform/notification/common/notification'; +import { INotificationService, IPromptChoice, INotificationProperties, Severity, IPromptOptions } from 'vs/platform/notification/common/notification'; import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @@ -159,7 +159,7 @@ suite('Experimental Prompts', () => { }; instantiationService.stub(INotificationService, { - prompt: (a: Severity, b: string, c: IPromptChoice[], options: INotificationProperties) => { + prompt: (a: Severity, b: string, c: IPromptChoice[], options: IPromptOptions) => { assert.equal(b, promptText); assert.equal(c.length, 2); options.onCancel!(); diff --git a/src/vs/workbench/services/notification/common/notificationService.ts b/src/vs/workbench/services/notification/common/notificationService.ts index ca8bc01d8b0..d118dd1590d 100644 --- a/src/vs/workbench/services/notification/common/notificationService.ts +++ b/src/vs/workbench/services/notification/common/notificationService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; -import { INotificationService, INotification, INotificationHandle, Severity, NotificationMessage, INotificationActions, IPromptChoice, INotificationProperties, IStatusMessageOptions, NoOpNotification, NeverShowAgainScope, NotificationsFilter } from 'vs/platform/notification/common/notification'; +import { INotificationService, INotification, INotificationHandle, Severity, NotificationMessage, INotificationActions, IPromptChoice, IStatusMessageOptions, NoOpNotification, NeverShowAgainScope, NotificationsFilter, IPromptOptions } from 'vs/platform/notification/common/notification'; import { NotificationsModel, ChoiceAction } from 'vs/workbench/common/notifications'; import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import { Event } from 'vs/base/common/event'; @@ -110,7 +110,7 @@ export class NotificationService extends Disposable implements INotificationServ return handle; } - prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: INotificationProperties): INotificationHandle { + prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle { const toDispose = new DisposableStore(); // Handle neverShowAgain option accordingly