Remove block padding (blank lines)
Also made a rule for it.
This commit is contained in:
@@ -1,30 +1,11 @@
|
||||
import { logger, field } from "@coder/logger";
|
||||
|
||||
/**
|
||||
* Handle for a notification that allows it to be closed and updated.
|
||||
*/
|
||||
export interface INotificationHandle {
|
||||
|
||||
/**
|
||||
* Closes the notification.
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
* Update the message.
|
||||
*/
|
||||
updateMessage(message: string): void;
|
||||
|
||||
/**
|
||||
* Update the buttons.
|
||||
*/
|
||||
updateButtons(buttons: INotificationButton[]): void;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification severity.
|
||||
*/
|
||||
export enum Severity {
|
||||
Ignore = 0,
|
||||
Info = 1,
|
||||
@@ -32,9 +13,6 @@ export enum Severity {
|
||||
Error = 3,
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification button.
|
||||
*/
|
||||
export interface INotificationButton {
|
||||
label: string;
|
||||
run(): void;
|
||||
@@ -44,48 +22,28 @@ export interface INotificationButton {
|
||||
* Optional notification service.
|
||||
*/
|
||||
export interface INotificationService {
|
||||
|
||||
/**
|
||||
* Display an error message.
|
||||
*/
|
||||
error(error: Error): void;
|
||||
|
||||
/**
|
||||
* Show a notification.
|
||||
*/
|
||||
prompt(severity: Severity, message: string, buttons: INotificationButton[], onCancel: () => void): INotificationHandle;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updatable progress.
|
||||
*/
|
||||
export interface IProgress {
|
||||
|
||||
/**
|
||||
* Report progress. Progress is the completed percentage from 0 to 100.
|
||||
* Report progress, which should be the completed percentage from 0 to 100.
|
||||
*/
|
||||
report(progress: number): void;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Option progress reporting service.
|
||||
*/
|
||||
export interface IProgressService {
|
||||
|
||||
/**
|
||||
* Start a new progress bar that resolves & disappears when the task finishes.
|
||||
*/
|
||||
start<T>(title: string, task: (progress: IProgress) => Promise<T>, onCancel: () => void): Promise<T>;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary notification service.
|
||||
*/
|
||||
export class NotificationService implements INotificationService {
|
||||
|
||||
public error(error: Error): void {
|
||||
logger.error(error.message, field("error", error));
|
||||
}
|
||||
@@ -93,14 +51,12 @@ export class NotificationService implements INotificationService {
|
||||
public prompt(_severity: Severity, message: string, _buttons: INotificationButton[], _onCancel: () => void): INotificationHandle {
|
||||
throw new Error(`cannot prompt using the console: ${message}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary progress service.
|
||||
*/
|
||||
export class ProgressService implements IProgressService {
|
||||
|
||||
public start<T>(title: string, task: (progress: IProgress) => Promise<T>): Promise<T> {
|
||||
logger.info(title);
|
||||
|
||||
@@ -110,5 +66,4 @@ export class ProgressService implements IProgressService {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user