@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
59 lines • 2.98 kB
TypeScript
import { CancellationToken, Disposable, Event } from '../common';
import URI from '../common/uri';
export interface DecorationsProvider {
/**
* Signals that decorations changed for the given resources. Firing `undefined` is a
* flush event: all previously provided decorations may have changed, cached data is
* dropped and re-fetched on demand. The last known decorations keep being served
* until the re-fetch of their resource settles, so that displayed decorations do
* not blink out while the round trip is in flight.
*/
readonly onDidChange: Event<URI[] | undefined>;
provideDecorations(uri: URI, token: CancellationToken): Decoration | Promise<Decoration | undefined> | undefined;
}
export interface Decoration {
readonly weight?: number;
readonly colorId?: string;
readonly letter?: string;
readonly tooltip?: string;
readonly bubble?: boolean;
}
export interface ResourceDecorationChangeEvent {
affectsResource(uri: URI): boolean;
}
export declare const DecorationsService: unique symbol;
export interface DecorationsService {
/**
* Fired when decorations changed. The payload maps the string representation of the
* affected resource URIs to their new decoration. Removals are never part of the
* payload: resources whose decoration was removed are simply absent, and an empty
* map signals that an unspecified set of decorations changed (e.g. a provider fired
* a flush event). Clients must therefore track the resources they display and
* re-query them on every event rather than react to the payload keys alone. Change
* notifications caused by asynchronously resolving decoration requests are batched:
* many resolutions result in a single event.
*/
readonly onDidChangeDecorations: Event<Map<string, Decoration>>;
registerDecorationsProvider(provider: DecorationsProvider): Disposable;
getDecoration(uri: URI, includeChildren: boolean): Decoration[];
}
export declare class DecorationsServiceImpl implements DecorationsService {
private readonly data;
private readonly onDidChangeDecorationsEmitter;
/**
* Accumulates decoration changes until the batched {@link onDidChangeDecorations}
* event fires. `undefined` values mark removed decorations.
*/
private readonly pendingChanges;
private pendingFlush;
readonly onDidChangeDecorations: Event<Map<string, Decoration>>;
/** Coalesces all changes of the same tick into a single event. */
protected readonly fireSoon: import("lodash").DebouncedFunc<() => void>;
dispose(): void;
registerDecorationsProvider(provider: DecorationsProvider): Disposable;
getDecoration(uri: URI, includeChildren: boolean): Decoration[];
protected notifyDecorationChange(uri: URI, decoration: Decoration | undefined): void;
protected notifyFlush(): void;
protected fireChangeEvent(): void;
}
//# sourceMappingURL=decorations-service.d.ts.map