import * as code from 'vscode'; import * as proto from 'vscode-languageserver-protocol'; import { DynamicFeature, RegistrationData, NextSignature, FeatureState, FeatureClient } from './features'; /** * File operation middleware * * @since 3.16.0 */ export interface FileOperationsMiddleware { didCreateFiles?: NextSignature>; willCreateFiles?: NextSignature>; didRenameFiles?: NextSignature>; willRenameFiles?: NextSignature>; didDeleteFiles?: NextSignature>; willDeleteFiles?: NextSignature>; } interface FileOperationsWorkspaceMiddleware { workspace?: FileOperationsMiddleware; } interface Event { readonly files: ReadonlyArray; } declare abstract class FileOperationFeature> implements DynamicFeature { protected readonly _client: FeatureClient; private readonly _event; private readonly _registrationType; private readonly _clientCapability; private readonly _serverCapability; private _listener; private readonly _filters; constructor(client: FeatureClient, event: code.Event, registrationType: proto.RegistrationType, clientCapability: keyof proto.FileOperationClientCapabilities, serverCapability: keyof proto.FileOperationOptions); getState(): FeatureState; protected filterSize(): number; get registrationType(): proto.RegistrationType; fillClientCapabilities(capabilities: proto.ClientCapabilities): void; initialize(capabilities: proto.ServerCapabilities): void; register(data: RegistrationData): void; abstract send(data: E): Promise; unregister(id: string): void; clear(): void; protected getFileType(uri: code.Uri): Promise; protected filter(event: E, prop: (i: I) => code.Uri): Promise; protected static getFileType(uri: code.Uri): Promise; private static asMinimatchOptions; } declare abstract class NotificationFileOperationFeature; }, P> extends FileOperationFeature { private _notificationType; private _accessUri; private _createParams; constructor(client: FeatureClient, event: code.Event, notificationType: proto.ProtocolNotificationType, clientCapability: keyof proto.FileOperationClientCapabilities, serverCapability: keyof proto.FileOperationOptions, accessUri: (i: I) => code.Uri, createParams: (e: E) => P); send(originalEvent: E): Promise; protected abstract doSend(event: E, next: (event: E) => Promise): Promise; } declare abstract class CachingNotificationFileOperationFeature; }, P> extends NotificationFileOperationFeature { protected _willListener: code.Disposable | undefined; private readonly _fsPathFileTypes; protected getFileType(uri: code.Uri): Promise; protected cacheFileTypes(event: E, prop: (i: I) => code.Uri): Promise; protected clearFileTypeCache(): void; unregister(id: string): void; clear(): void; } export declare class DidCreateFilesFeature extends NotificationFileOperationFeature { constructor(client: FeatureClient); protected doSend(event: code.FileCreateEvent, next: (event: code.FileCreateEvent) => Promise): Promise; } export declare class DidRenameFilesFeature extends CachingNotificationFileOperationFeature<{ oldUri: code.Uri; newUri: code.Uri; }, code.FileRenameEvent, proto.RenameFilesParams> { constructor(client: FeatureClient); register(data: RegistrationData): void; private willRename; protected doSend(event: code.FileRenameEvent, next: (event: code.FileRenameEvent) => Promise): Promise; } export declare class DidDeleteFilesFeature extends CachingNotificationFileOperationFeature { constructor(client: FeatureClient); register(data: RegistrationData): void; private willDelete; protected doSend(event: code.FileCreateEvent, next: (event: code.FileCreateEvent) => Promise): Promise; } interface RequestEvent { readonly token: code.CancellationToken; readonly files: ReadonlyArray; waitUntil(thenable: Thenable): void; waitUntil(thenable: Thenable): void; } declare abstract class RequestFileOperationFeature, P> extends FileOperationFeature { private _requestType; private _accessUri; private _createParams; constructor(client: FeatureClient, event: code.Event, requestType: proto.ProtocolRequestType, clientCapability: keyof proto.FileOperationClientCapabilities, serverCapability: keyof proto.FileOperationOptions, accessUri: (i: I) => code.Uri, createParams: (e: Event) => P); send(originalEvent: E & RequestEvent): Promise; private waitUntil; protected abstract doSend(event: E, next: (event: RequestEvent) => Thenable | Thenable): Thenable | Thenable; } export declare class WillCreateFilesFeature extends RequestFileOperationFeature { constructor(client: FeatureClient); protected doSend(event: code.FileWillCreateEvent, next: (event: code.FileWillCreateEvent) => Thenable | Thenable): Thenable | Thenable; } export declare class WillRenameFilesFeature extends RequestFileOperationFeature<{ oldUri: code.Uri; newUri: code.Uri; }, code.FileWillRenameEvent, proto.RenameFilesParams> { constructor(client: FeatureClient); protected doSend(event: code.FileWillRenameEvent, next: (event: code.FileWillRenameEvent) => Thenable | Thenable): Thenable | Thenable; } export declare class WillDeleteFilesFeature extends RequestFileOperationFeature { constructor(client: FeatureClient); protected doSend(event: code.FileWillDeleteEvent, next: (event: code.FileWillDeleteEvent) => Thenable | Thenable): Thenable | Thenable; } export {};