import { TextDocument, Event as VEvent, DocumentSelector as VDocumentSelector, Event, Disposable, CancellationToken, ProviderResult, TextEdit as VTextEdit, ReferenceProvider, DefinitionProvider, SignatureHelpProvider, HoverProvider, CompletionItemProvider, WorkspaceSymbolProvider, DocumentHighlightProvider, CodeActionProvider, DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider, RenameProvider, DocumentSymbolProvider, DocumentLinkProvider, DocumentColorProvider, DeclarationProvider, ImplementationProvider, SelectionRangeProvider, TypeDefinitionProvider, CallHierarchyProvider, LinkedEditingRangeProvider, TypeHierarchyProvider, FileCreateEvent, FileRenameEvent, FileDeleteEvent, FileWillCreateEvent, FileWillRenameEvent, FileWillDeleteEvent, CancellationError, InlineCompletionItemProvider } from 'vscode'; import { CallHierarchyPrepareRequest, ClientCapabilities, CodeActionRequest, CodeLensRequest, CompletionRequest, DeclarationRequest, DefinitionRequest, DidChangeTextDocumentNotification, DidCloseTextDocumentNotification, DidCreateFilesNotification, DidDeleteFilesNotification, DidOpenTextDocumentNotification, DidRenameFilesNotification, DidSaveTextDocumentNotification, DocumentColorRequest, DocumentDiagnosticRequest, DocumentFormattingRequest, DocumentHighlightRequest, DocumentLinkRequest, DocumentOnTypeFormattingRequest, DocumentRangeFormattingRequest, DocumentSelector, DocumentSymbolRequest, ExecuteCommandOptions, ExecuteCommandRequest, FileOperationRegistrationOptions, FoldingRangeRequest, GenericNotificationHandler, GenericRequestHandler, HoverRequest, ImplementationRequest, InitializeParams, InlayHintRequest, InlineCompletionRegistrationOptions, InlineCompletionRequest, InlineValueRequest, LinkedEditingRangeRequest, MessageSignature, NotebookDocumentSyncRegistrationOptions, NotebookDocumentSyncRegistrationType, NotificationHandler, NotificationHandler0, NotificationType, NotificationType0, ProgressType, ProtocolNotificationType, ProtocolNotificationType0, ProtocolRequestType, ProtocolRequestType0, ReferencesRequest, RegistrationType, RenameRequest, RequestHandler, RequestHandler0, RequestType, RequestType0, SelectionRangeRequest, SemanticTokensRegistrationType, ServerCapabilities, SignatureHelpRequest, StaticRegistrationOptions, TextDocumentIdentifier, TextDocumentRegistrationOptions, TypeDefinitionRequest, TypeHierarchyPrepareRequest, WillCreateFilesRequest, WillDeleteFilesRequest, WillRenameFilesRequest, WillSaveTextDocumentNotification, WillSaveTextDocumentWaitUntilRequest, WorkspaceSymbolRequest } from 'vscode-languageserver-protocol'; import type * as c2p from './codeConverter'; import type * as p2c from './protocolConverter'; export declare class LSPCancellationError extends CancellationError { readonly data: object | Object; constructor(data: object | Object); } export declare function ensure(target: T, key: K): T[K]; export interface NextSignature { (this: void, data: P, next: (data: P) => R): R; } export interface RegistrationData { id: string; registerOptions: T; } export type FeatureStateKind = 'document' | 'workspace' | 'static' | 'window'; export type FeatureState = { kind: 'document'; /** * The features's id. This is usually the method names used during * registration. */ id: string; /** * Has active registrations. */ registrations: boolean; /** * A registration matches an open document. */ matches: boolean; } | { kind: 'workspace'; /** * The features's id. This is usually the method names used during * registration. */ id: string; /** * Has active registrations. */ registrations: boolean; } | { kind: 'window'; /** * The features's id. This is usually the method names used during * registration. */ id: string; /** * Has active registrations. */ registrations: boolean; } | { kind: 'static'; }; /** * A static feature. A static feature can't be dynamically activated via the * server. It is wired during the initialize sequence. */ export interface StaticFeature { /** * Called to fill the initialize params. * * @params the initialize params. */ fillInitializeParams?: (params: InitializeParams) => void; /** * Called to fill in the client capabilities this feature implements. * * @param capabilities The client capabilities to fill. */ fillClientCapabilities(capabilities: ClientCapabilities): void; /** * A preflight where the server capabilities are shown to all features * before a feature is actually initialized. This allows feature to * capture some state if they are a pre-requisite for other features. * * @param capabilities the server capabilities * @param documentSelector the document selector pass to the client's constructor. * May be `undefined` if the client was created without a selector. */ preInitialize?: (capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined) => void; /** * Initialize the feature. This method is called on a feature instance * when the client has successfully received the initialize request from * the server and before the client sends the initialized notification * to the server. * * @param capabilities the server capabilities * @param documentSelector the document selector pass to the client's constructor. * May be `undefined` if the client was created without a selector. */ initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined): void; /** * Returns the state the feature is in. */ getState(): FeatureState; /** * Called when the client is stopped or re-started to clear this feature. * Usually a feature un-registers listeners registered hooked up with the * VS Code extension host. */ clear(): void; } export declare namespace StaticFeature { function is(value: any): value is StaticFeature; } /** * A dynamic feature can be activated via the server. */ export interface DynamicFeature { /** * Called to fill the initialize params. * * @params the initialize params. */ fillInitializeParams?: (params: InitializeParams) => void; /** * Called to fill in the client capabilities this feature implements. * * @param capabilities The client capabilities to fill. */ fillClientCapabilities(capabilities: ClientCapabilities): void; /** * A preflight where the server capabilities are shown to all features * before a feature is actually initialized. This allows feature to * capture some state if they are a pre-requisite for other features. * * @param capabilities the server capabilities * @param documentSelector the document selector pass to the client's constructor. * May be `undefined` if the client was created without a selector. */ preInitialize?: (capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined) => void; /** * Initialize the feature. This method is called on a feature instance * when the client has successfully received the initialize request from * the server and before the client sends the initialized notification * to the server. * * @param capabilities the server capabilities. * @param documentSelector the document selector pass to the client's constructor. * May be `undefined` if the client was created without a selector. */ initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined): void; /** * Returns the state the feature is in. */ getState(): FeatureState; /** * The signature (e.g. method) for which this features support dynamic activation / registration. */ registrationType: RegistrationType; /** * Is called when the server send a register request for the given message. * * @param data additional registration data as defined in the protocol. */ register(data: RegistrationData): void; /** * Is called when the server wants to unregister a feature. * * @param id the id used when registering the feature. */ unregister(id: string): void; /** * Called when the client is stopped or re-started to clear this feature. * Usually a feature un-registers listeners registered hooked up with the * VS Code extension host. */ clear(): void; } export declare namespace DynamicFeature { function is(value: any): value is DynamicFeature; } interface CreateParamsSignature { (data: E): P; } export interface NotificationSendEvent

{ textDocument: TextDocument; type: ProtocolNotificationType; params: P; } export interface NotifyingFeature

{ onNotificationSent: VEvent>; } /** * An abstract dynamic feature implementation that operates on documents (e.g. text * documents or notebooks). */ export declare abstract class DynamicDocumentFeature implements DynamicFeature { protected readonly _client: FeatureClient; constructor(client: FeatureClient); abstract fillClientCapabilities(capabilities: ClientCapabilities): void; abstract initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined): void; abstract registrationType: RegistrationType; abstract register(data: RegistrationData): void; abstract unregister(id: string): void; abstract clear(): void; /** * Returns the state the feature is in. */ getState(): FeatureState; protected abstract getDocumentSelectors(): IterableIterator; } /** * A mixin type that allows to send notification or requests using a registered * provider. */ export interface TextDocumentSendFeature { /** * Returns a provider for the given text document. */ getProvider(document: TextDocument): { send: T; } | undefined; } /** * An abstract base class to implement features that react to events * emitted from text documents. */ export declare abstract class TextDocumentEventFeature

extends DynamicDocumentFeature implements TextDocumentSendFeature<(data: E) => Promise>, NotifyingFeature

{ private readonly _event; protected readonly _type: ProtocolNotificationType; protected readonly _middleware: () => NextSignature> | undefined; protected readonly _createParams: CreateParamsSignature; protected readonly _textDocument: (data: E) => TextDocument; protected readonly _selectorFilter?: (selectors: IterableIterator, data: E) => boolean; private _listener; protected readonly _selectors: Map; private readonly _onNotificationSent; static textDocumentFilter(selectors: IterableIterator, textDocument: TextDocument): boolean; constructor(client: FeatureClient, event: Event, type: ProtocolNotificationType, middleware: () => NextSignature> | undefined, createParams: CreateParamsSignature, textDocument: (data: E) => TextDocument, selectorFilter?: (selectors: IterableIterator, data: E) => boolean); protected getStateInfo(): [IterableIterator, boolean]; protected getDocumentSelectors(): IterableIterator; register(data: RegistrationData): void; protected callback(data: E): Promise; private matches; get onNotificationSent(): VEvent>; protected notificationSent(textDocument: TextDocument, type: ProtocolNotificationType, params: P): void; protected abstract getTextDocument(data: E): TextDocument; unregister(id: string): void; clear(): void; getProvider(document: TextDocument): { send: (data: E) => Promise; } | undefined; } /** * A mixin type to access a provider that is registered for a * given text document / document selector. */ export interface TextDocumentProviderFeature { /** * Triggers the corresponding RPC method. */ getProvider(textDocument: TextDocument): T | undefined; } export type DocumentSelectorOptions = { documentSelector: DocumentSelector; }; /** * A abstract feature implementation that registers language providers * for text documents using a given document selector. */ export declare abstract class TextDocumentLanguageFeature extends DynamicDocumentFeature { private readonly _registrationType; private readonly _registrations; constructor(client: FeatureClient, registrationType: RegistrationType); protected getDocumentSelectors(): IterableIterator; get registrationType(): RegistrationType; abstract fillClientCapabilities(capabilities: ClientCapabilities): void; abstract initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; register(data: RegistrationData): void; protected abstract registerLanguageProvider(options: RO, id: string): [Disposable, PR]; unregister(id: string): void; clear(): void; protected getRegistration(documentSelector: DocumentSelector | undefined, capability: undefined | PO | (RO & StaticRegistrationOptions)): [string | undefined, (RO & { documentSelector: DocumentSelector; }) | undefined]; protected getRegistrationOptions(documentSelector: DocumentSelector | undefined, capability: undefined | PO): (RO & { documentSelector: DocumentSelector; }) | undefined; getProvider(textDocument: TextDocument): PR | undefined; protected getAllProviders(): Iterable; } export interface WorkspaceProviderFeature { getProviders(): PR[] | undefined; } type WorkspaceFeatureRegistration = { disposable: Disposable; provider: PR; }; export declare abstract class WorkspaceFeature implements DynamicFeature { protected readonly _client: FeatureClient; private readonly _registrationType; protected readonly _registrations: Map>; constructor(client: FeatureClient, registrationType: RegistrationType); getState(): FeatureState; get registrationType(): RegistrationType; abstract fillClientCapabilities(capabilities: ClientCapabilities): void; abstract initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector | undefined): void; register(data: RegistrationData): void; protected abstract registerLanguageProvider(options: RO): [Disposable, PR]; unregister(id: string): void; clear(): void; getProviders(): PR[]; } export interface DedicatedTextSynchronizationFeature { handles(textDocument: TextDocument): boolean; } import type { SemanticTokensProviderShape } from './semanticTokens'; import type { DidChangeTextDocumentFeatureShape, DidCloseTextDocumentFeatureShape, DidOpenTextDocumentFeatureShape, DidSaveTextDocumentFeatureShape } from './textSynchronization'; import type { CodeLensProviderShape } from './codeLens'; import type { InlineValueProviderShape } from './inlineValue'; import type { InlayHintsProviderShape } from './inlayHint'; import type { DiagnosticProviderShape } from './diagnostic'; import type { NotebookDocumentProviderShape } from './notebook'; import { FoldingRangeProviderShape } from './foldingRange'; export interface FeatureClient { protocol2CodeConverter: p2c.Converter; code2ProtocolConverter: c2p.Converter; clientOptions: CO; middleware: M; start(): Promise; isRunning(): boolean; stop(): Promise; sendRequest(type: ProtocolRequestType0, token?: CancellationToken): Promise; sendRequest(type: ProtocolRequestType, params: P, token?: CancellationToken): Promise; sendRequest(type: RequestType0, token?: CancellationToken): Promise; sendRequest(type: RequestType, params: P, token?: CancellationToken): Promise; sendRequest(method: string, token?: CancellationToken): Promise; sendRequest(method: string, param: any, token?: CancellationToken): Promise; onRequest(type: ProtocolRequestType0, handler: RequestHandler0): Disposable; onRequest(type: ProtocolRequestType, handler: RequestHandler): Disposable; onRequest(type: RequestType0, handler: RequestHandler0): Disposable; onRequest(type: RequestType, handler: RequestHandler): Disposable; onRequest(method: string, handler: GenericRequestHandler): Disposable; sendNotification(type: ProtocolNotificationType0): Promise; sendNotification(type: ProtocolNotificationType, params?: P): Promise; sendNotification(type: NotificationType0): Promise; sendNotification

(type: NotificationType

, params?: P): Promise; sendNotification(method: string): Promise; sendNotification(method: string, params: any): Promise; onNotification(type: ProtocolNotificationType0, handler: NotificationHandler0): Disposable; onNotification(type: ProtocolNotificationType, handler: NotificationHandler

): Disposable; onNotification(type: NotificationType0, handler: NotificationHandler0): Disposable; onNotification

(type: NotificationType

, handler: NotificationHandler

): Disposable; onNotification(method: string, handler: GenericNotificationHandler): Disposable; onProgress

(type: ProgressType

, token: string | number, handler: NotificationHandler

): Disposable; info(message: string, data?: any, showNotification?: boolean): void; warn(message: string, data?: any, showNotification?: boolean): void; error(message: string, data?: any, showNotification?: boolean | 'force'): void; handleFailedRequest(type: MessageSignature, token: CancellationToken | undefined, error: any, defaultValue: T, showNotification?: boolean): T; hasDedicatedTextSynchronizationFeature(textDocument: TextDocument): boolean; getFeature(request: typeof DidOpenTextDocumentNotification.method): DidOpenTextDocumentFeatureShape; getFeature(request: typeof DidChangeTextDocumentNotification.method): DidChangeTextDocumentFeatureShape; getFeature(request: typeof WillSaveTextDocumentNotification.method): DynamicFeature & TextDocumentSendFeature<(textDocument: TextDocument) => Promise>; getFeature(request: typeof WillSaveTextDocumentWaitUntilRequest.method): DynamicFeature & TextDocumentSendFeature<(textDocument: TextDocument) => ProviderResult>; getFeature(request: typeof DidSaveTextDocumentNotification.method): DidSaveTextDocumentFeatureShape; getFeature(request: typeof DidCloseTextDocumentNotification.method): DidCloseTextDocumentFeatureShape; getFeature(request: typeof DidCreateFilesNotification.method): DynamicFeature & { send: (event: FileCreateEvent) => Promise; }; getFeature(request: typeof DidRenameFilesNotification.method): DynamicFeature & { send: (event: FileRenameEvent) => Promise; }; getFeature(request: typeof DidDeleteFilesNotification.method): DynamicFeature & { send: (event: FileDeleteEvent) => Promise; }; getFeature(request: typeof WillCreateFilesRequest.method): DynamicFeature & { send: (event: FileWillCreateEvent) => Promise; }; getFeature(request: typeof WillRenameFilesRequest.method): DynamicFeature & { send: (event: FileWillRenameEvent) => Promise; }; getFeature(request: typeof WillDeleteFilesRequest.method): DynamicFeature & { send: (event: FileWillDeleteEvent) => Promise; }; getFeature(request: typeof CompletionRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof HoverRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof SignatureHelpRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DefinitionRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof ReferencesRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentHighlightRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof CodeActionRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof CodeLensRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentFormattingRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentRangeFormattingRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentOnTypeFormattingRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof RenameRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentSymbolRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentLinkRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DocumentColorRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof DeclarationRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof FoldingRangeRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof ImplementationRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof SelectionRangeRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof TypeDefinitionRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof CallHierarchyPrepareRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof SemanticTokensRegistrationType.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof LinkedEditingRangeRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof TypeHierarchyPrepareRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof InlineValueRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof InlayHintRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof WorkspaceSymbolRequest.method): DynamicFeature & WorkspaceProviderFeature; getFeature(request: typeof DocumentDiagnosticRequest.method): DynamicFeature & TextDocumentProviderFeature | undefined; getFeature(request: typeof NotebookDocumentSyncRegistrationType.method): DynamicFeature & NotebookDocumentProviderShape | undefined; getFeature(request: typeof InlineCompletionRequest.method): DynamicFeature & TextDocumentProviderFeature; getFeature(request: typeof ExecuteCommandRequest.method): DynamicFeature; } export {};