revert onCancel

This commit is contained in:
Sandeep Somavarapu
2020-11-23 16:09:03 +01:00
parent 5e82d27fa7
commit a2ca2bbb1c
3 changed files with 14 additions and 11 deletions
@@ -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.
@@ -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!();
@@ -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