UNPKG

1.71 kBTypeScriptView Raw
1import { Disposable, TextDocument, ProviderResult, Range as VRange, InlayHint as VInlayHint, InlayHintsProvider, EventEmitter } from 'vscode';
2import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, InlayHintOptions, InlayHintRegistrationOptions } from 'vscode-languageserver-protocol';
3import { TextDocumentLanguageFeature, FeatureClient } from './features';
4export type ProvideInlayHintsSignature = (this: void, document: TextDocument, viewPort: VRange, token: CancellationToken) => ProviderResult<VInlayHint[]>;
5export type ResolveInlayHintSignature = (this: void, item: VInlayHint, token: CancellationToken) => ProviderResult<VInlayHint>;
6export type InlayHintsMiddleware = {
7 provideInlayHints?: (this: void, document: TextDocument, viewPort: VRange, token: CancellationToken, next: ProvideInlayHintsSignature) => ProviderResult<VInlayHint[]>;
8 resolveInlayHint?: (this: void, item: VInlayHint, token: CancellationToken, next: ResolveInlayHintSignature) => ProviderResult<VInlayHint>;
9};
10export type InlayHintsProviderShape = {
11 provider: InlayHintsProvider;
12 onDidChangeInlayHints: EventEmitter<void>;
13};
14export declare class InlayHintsFeature extends TextDocumentLanguageFeature<boolean | InlayHintOptions, InlayHintRegistrationOptions, InlayHintsProviderShape, InlayHintsMiddleware> {
15 constructor(client: FeatureClient<InlayHintsMiddleware>);
16 fillClientCapabilities(capabilities: ClientCapabilities): void;
17 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
18 protected registerLanguageProvider(options: InlayHintRegistrationOptions): [Disposable, InlayHintsProviderShape];
19 private registerProvider;
20}