import { AbstractCancellationTokenSource, Event } from 'vscode-jsonrpc'; import { CancellationToken, Disposable, ResponseError } from 'vscode-languageserver'; import { Uri } from './uri/uri'; export interface CancellationProvider { createCancellationTokenSource(): AbstractCancellationTokenSource; } export declare namespace CancellationProvider { function is(value: any): value is CancellationProvider; } export declare function getCancellationFolderName(): string | undefined; export declare function setCancellationFolderName(folderName?: string): void; export declare function invalidateTypeCacheIfCanceled(cb: () => T): T; export declare class OperationCanceledException extends ResponseError { isTypeCacheInvalid: boolean; constructor(message?: string | undefined); static is(e: any): e is OperationCanceledException; } export declare function throwIfCancellationRequested(token: CancellationToken): void; export declare function onCancellationRequested(token: CancellationToken, func: (i: any) => void): Disposable; export declare function CancelAfter(provider: CancellationProvider, ...tokens: CancellationToken[]): AbstractCancellationTokenSource; export declare function createCombinedToken(...tokens: CancellationToken[]): CancellationToken; export declare function setupCombinedTokensFor(source: AbstractCancellationTokenSource, ...tokens: CancellationToken[]): void; export declare class DefaultCancellationProvider implements CancellationProvider { createCancellationTokenSource(): AbstractCancellationTokenSource; } export declare const CancelledTokenId = "cancelled"; export declare function getCancellationTokenId(token: CancellationToken): string | undefined; export declare class FileBasedToken implements CancellationToken { private _fs; protected readonly cancellationFilePath: Uri; protected isCancelled: boolean; private _emitter; constructor(cancellationId: string, _fs: { statSync(fileUri: Uri): void; }); get id(): string; get isCancellationRequested(): boolean; get onCancellationRequested(): Event; cancel(): void; dispose(): void; private _disposeEmitter; private _pipeExists; } export declare class CancellationThrottle { private static _lastCheckTimestamp; static shouldCheck(): boolean; } export declare function raceCancellation(token?: CancellationToken, ...promises: Promise[]): Promise;