UNPKG

1.71 kBTypeScriptView Raw
1import { Disposable, TextDocument, ProviderResult, Range as VRange, Command as VCommand, CodeAction as VCodeAction, CodeActionContext as VCodeActionContext, CodeActionProvider } from 'vscode';
2import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, CodeActionOptions, CodeActionRegistrationOptions } from 'vscode-languageserver-protocol';
3import { TextDocumentLanguageFeature, FeatureClient } from './features';
4export interface ProvideCodeActionsSignature {
5 (this: void, document: TextDocument, range: VRange, context: VCodeActionContext, token: CancellationToken): ProviderResult<(VCommand | VCodeAction)[]>;
6}
7export interface ResolveCodeActionSignature {
8 (this: void, item: VCodeAction, token: CancellationToken): ProviderResult<VCodeAction>;
9}
10export interface CodeActionMiddleware {
11 provideCodeActions?: (this: void, document: TextDocument, range: VRange, context: VCodeActionContext, token: CancellationToken, next: ProvideCodeActionsSignature) => ProviderResult<(VCommand | VCodeAction)[]>;
12 resolveCodeAction?: (this: void, item: VCodeAction, token: CancellationToken, next: ResolveCodeActionSignature) => ProviderResult<VCodeAction>;
13}
14export declare class CodeActionFeature extends TextDocumentLanguageFeature<boolean | CodeActionOptions, CodeActionRegistrationOptions, CodeActionProvider, CodeActionMiddleware> {
15 constructor(client: FeatureClient<CodeActionMiddleware>);
16 fillClientCapabilities(capabilities: ClientCapabilities): void;
17 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
18 protected registerLanguageProvider(options: CodeActionRegistrationOptions): [Disposable, CodeActionProvider];
19}