@@ -37,8 +37,9 @@ export class ProgressAddon implements ITerminalAddon, IProgressApi {
|
|||||||
private _seqHandler: IDisposable | undefined;
|
private _seqHandler: IDisposable | undefined;
|
||||||
private _st: ProgressType = ProgressType.REMOVE;
|
private _st: ProgressType = ProgressType.REMOVE;
|
||||||
private _pr = 0;
|
private _pr = 0;
|
||||||
private _onChange: Emitter<IProgressState> | undefined;
|
// HACK: This uses ! to align with the API, this should be fixed when 5283 is resolved
|
||||||
public onChange: Event<IProgressState> | undefined;
|
private _onChange!: Emitter<IProgressState>;
|
||||||
|
public onChange!: Event<IProgressState>;
|
||||||
|
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
this._seqHandler?.dispose();
|
this._seqHandler?.dispose();
|
||||||
|
|||||||
+22
-8
@@ -3,9 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Terminal, ITerminalAddon, IDisposable } from '@xterm/xterm';
|
import { Terminal, ITerminalAddon, IDisposable, IEvent } from '@xterm/xterm';
|
||||||
import type { Event } from 'vs/base/common/event';
|
|
||||||
|
|
||||||
|
|
||||||
declare module '@xterm/addon-progress' {
|
declare module '@xterm/addon-progress' {
|
||||||
/**
|
/**
|
||||||
@@ -33,13 +31,12 @@ declare module '@xterm/addon-progress' {
|
|||||||
/**
|
/**
|
||||||
* An event that fires when the tracked progress changes.
|
* An event that fires when the tracked progress changes.
|
||||||
*/
|
*/
|
||||||
public readonly onChange: Event<IProgressState> | undefined;
|
public readonly onChange: IEvent<IProgressState> | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or sets the current progress tracked by the addon.
|
* Gets or sets the current progress tracked by the addon. This can be used
|
||||||
* This can also be used to reset a stuck progress indicator
|
* to reset a stuck progress indicator back to initial with
|
||||||
* back to initial with `{state: 0, value: 0}`
|
* `{ state: 0, value: 0 }` or to restore an indicator.
|
||||||
* or to restore an indicator.
|
|
||||||
*/
|
*/
|
||||||
public progress: IProgressState;
|
public progress: IProgressState;
|
||||||
}
|
}
|
||||||
@@ -48,7 +45,24 @@ declare module '@xterm/addon-progress' {
|
|||||||
* Progress state tracked by the addon.
|
* Progress state tracked by the addon.
|
||||||
*/
|
*/
|
||||||
export interface IProgressState {
|
export interface IProgressState {
|
||||||
|
/**
|
||||||
|
* The progress state.
|
||||||
|
*
|
||||||
|
* - `0`: No progress. Setting this will resets progress value to 0
|
||||||
|
* regardless of the {@link value} used.
|
||||||
|
* - `1`: Normal percentage-based from 0 to 100.
|
||||||
|
* - `2`: Error with an optional progress value from 0 to 100.
|
||||||
|
* - `3`: Indeterminate progress, any progress value will be ignored. This
|
||||||
|
* is used to indicate work is happening but a percentage value cannot be
|
||||||
|
* determined.
|
||||||
|
* - `4`: Pause or warning state with an optional progress value.
|
||||||
|
*/
|
||||||
state: 0 | 1 | 2 | 3 | 4;
|
state: 0 | 1 | 2 | 3 | 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The percentage value of progress from 0 to 100. See {@link state} for
|
||||||
|
* whether this is relevant.
|
||||||
|
*/
|
||||||
value: number;
|
value: number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user