Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -4,9 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import BaseSeverity from 'vs/base/common/severity';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IAction } from 'vs/base/common/actions';
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
export import Severity = BaseSeverity;
@@ -69,14 +70,14 @@ export interface INotificationActions {
* Primary actions show up as buttons as part of the message and will close
* the notification once clicked.
*/
primary?: IAction[];
primary?: ReadonlyArray<IAction>;
/**
* Secondary actions are meant to provide additional configuration or context
* for the notification and will show up less prominent. A notification does not
* close automatically when invoking a secondary action.
*/
secondary?: IAction[];
secondary?: ReadonlyArray<IAction>;
}
export interface INotificationProgress {
@@ -172,6 +173,21 @@ export interface IPromptOptions extends INotificationProperties {
onCancel?: () => void;
}
export interface IStatusMessageOptions {
/**
* An optional timeout after which the status message should show. By default
* the status message will show immediately.
*/
showAfter?: number;
/**
* An optional timeout after which the status message is to be hidden. By default
* the status message will not hide until another status message is displayed.
*/
hideAfter?: number;
}
/**
* A service to bring up notifications and non-modal prompts.
*
@@ -179,7 +195,7 @@ export interface IPromptOptions extends INotificationProperties {
*/
export interface INotificationService {
_serviceBrand: any;
_serviceBrand: ServiceIdentifier<INotificationService>;
/**
* Show the provided notification to the user. The returned `INotificationHandle`
@@ -194,19 +210,19 @@ export interface INotificationService {
notify(notification: INotification): INotificationHandle;
/**
* A convinient way of reporting infos. Use the `INotificationService.notify`
* A convenient way of reporting infos. Use the `INotificationService.notify`
* method if you need more control over the notification.
*/
info(message: NotificationMessage | NotificationMessage[]): void;
/**
* A convinient way of reporting warnings. Use the `INotificationService.notify`
* A convenient way of reporting warnings. Use the `INotificationService.notify`
* method if you need more control over the notification.
*/
warn(message: NotificationMessage | NotificationMessage[]): void;
/**
* A convinient way of reporting errors. Use the `INotificationService.notify`
* A convenient way of reporting errors. Use the `INotificationService.notify`
* method if you need more control over the notification.
*/
error(message: NotificationMessage | NotificationMessage[]): void;
@@ -221,16 +237,24 @@ 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[], options?: IPromptOptions): INotificationHandle;
/**
* Shows a status message in the status area with the provided text.
*
* @param message the message to show as status
* @param options provides some optional configuration options
*
* @returns a disposable to hide the status message
*/
status(message: NotificationMessage, options?: IStatusMessageOptions): IDisposable;
}
export class NoOpNotification implements INotificationHandle {
readonly progress = new NoOpProgress();
private readonly _onDidClose: Emitter<void> = new Emitter();
get onDidClose(): Event<void> {
return this._onDidClose.event;
}
readonly onDidClose: Event<void> = this._onDidClose.event;
updateSeverity(severity: Severity): void { }
updateMessage(message: NotificationMessage): void { }

View File

@@ -3,31 +3,36 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { INotificationService, INotificationHandle, NoOpNotification, Severity, INotification, IPromptChoice, IPromptOptions } from 'vs/platform/notification/common/notification';
import { INotificationService, INotificationHandle, NoOpNotification, Severity, INotification, IPromptChoice, IPromptOptions, IStatusMessageOptions } from 'vs/platform/notification/common/notification';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
export class TestNotificationService implements INotificationService {
public _serviceBrand: any;
_serviceBrand: any;
private static readonly NO_OP: INotificationHandle = new NoOpNotification();
public info(message: string): INotificationHandle {
info(message: string): INotificationHandle {
return this.notify({ severity: Severity.Info, message });
}
public warn(message: string): INotificationHandle {
warn(message: string): INotificationHandle {
return this.notify({ severity: Severity.Warning, message });
}
public error(error: string | Error): INotificationHandle {
error(error: string | Error): INotificationHandle {
return this.notify({ severity: Severity.Error, message: error });
}
public notify(notification: INotification): INotificationHandle {
notify(notification: INotification): INotificationHandle {
return TestNotificationService.NO_OP;
}
public prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle {
prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle {
return TestNotificationService.NO_OP;
}
status(message: string | Error, options?: IStatusMessageOptions): IDisposable {
return Disposable.None;
}
}