UNPKG

1.36 kBTypeScriptView Raw
1import { CancellationToken, ProgressToken, ProgressType, WorkDoneProgressParams, PartialResultParams } from 'vscode-languageserver-protocol';
2import type { Feature, _RemoteWindow } from './server';
3export interface ProgressContext {
4 sendProgress<P>(type: ProgressType<P>, token: ProgressToken, value: P): void;
5}
6export interface WorkDoneProgressReporter {
7 begin(title: string, percentage?: number, message?: string, cancellable?: boolean): void;
8 report(percentage: number): void;
9 report(message: string): void;
10 report(percentage: number, message: string): void;
11 done(): void;
12}
13export interface WorkDoneProgressServerReporter extends WorkDoneProgressReporter {
14 readonly token: CancellationToken;
15}
16export interface WindowProgress {
17 attachWorkDoneProgress(token: ProgressToken | undefined): WorkDoneProgressReporter;
18 createWorkDoneProgress(): Promise<WorkDoneProgressServerReporter>;
19}
20export declare function attachWorkDone(connection: ProgressContext, params: WorkDoneProgressParams | undefined): WorkDoneProgressReporter;
21export declare const ProgressFeature: Feature<_RemoteWindow, WindowProgress>;
22export interface ResultProgressReporter<R> {
23 report(data: R): void;
24}
25export declare function attachPartialResult<R>(connection: ProgressContext, params: PartialResultParams): ResultProgressReporter<R> | undefined;