UNPKG

1.61 kBTypeScriptView Raw
1import { Disposable, TextDocument, ProviderResult, EventEmitter, CodeLensProvider, CodeLens as VCodeLens } from 'vscode';
2import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, CodeLensOptions, CodeLensRegistrationOptions } from 'vscode-languageserver-protocol';
3import { TextDocumentLanguageFeature, FeatureClient } from './features';
4export interface ProvideCodeLensesSignature {
5 (this: void, document: TextDocument, token: CancellationToken): ProviderResult<VCodeLens[]>;
6}
7export interface ResolveCodeLensSignature {
8 (this: void, codeLens: VCodeLens, token: CancellationToken): ProviderResult<VCodeLens>;
9}
10export interface CodeLensMiddleware {
11 provideCodeLenses?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideCodeLensesSignature) => ProviderResult<VCodeLens[]>;
12 resolveCodeLens?: (this: void, codeLens: VCodeLens, token: CancellationToken, next: ResolveCodeLensSignature) => ProviderResult<VCodeLens>;
13}
14export type CodeLensProviderShape = {
15 provider?: CodeLensProvider;
16 onDidChangeCodeLensEmitter: EventEmitter<void>;
17};
18export declare class CodeLensFeature extends TextDocumentLanguageFeature<CodeLensOptions, CodeLensRegistrationOptions, CodeLensProviderShape, CodeLensMiddleware> {
19 constructor(client: FeatureClient<CodeLensMiddleware>);
20 fillClientCapabilities(capabilities: ClientCapabilities): void;
21 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
22 protected registerLanguageProvider(options: CodeLensRegistrationOptions): [Disposable, CodeLensProviderShape];
23}