UNPKG

1.86 kBTypeScriptView Raw
1import { TextDocument, Disposable, Position as VPosition, CompletionContext as VCompletionContext, CancellationToken, ProviderResult, CompletionItem as VCompletionItem, CompletionList as VCompletionList, CompletionItemProvider } from 'vscode';
2import { ClientCapabilities, CompletionOptions, CompletionRegistrationOptions, DocumentSelector, ServerCapabilities } from 'vscode-languageserver-protocol';
3import { FeatureClient, TextDocumentLanguageFeature } from './features';
4export interface ProvideCompletionItemsSignature {
5 (this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken): ProviderResult<VCompletionItem[] | VCompletionList>;
6}
7export interface ResolveCompletionItemSignature {
8 (this: void, item: VCompletionItem, token: CancellationToken): ProviderResult<VCompletionItem>;
9}
10export interface CompletionMiddleware {
11 provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
12 resolveCompletionItem?: (this: void, item: VCompletionItem, token: CancellationToken, next: ResolveCompletionItemSignature) => ProviderResult<VCompletionItem>;
13}
14export declare class CompletionItemFeature extends TextDocumentLanguageFeature<CompletionOptions, CompletionRegistrationOptions, CompletionItemProvider, CompletionMiddleware> {
15 private labelDetailsSupport;
16 constructor(client: FeatureClient<CompletionMiddleware>);
17 fillClientCapabilities(capabilities: ClientCapabilities): void;
18 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
19 protected registerLanguageProvider(options: CompletionRegistrationOptions, id: string): [Disposable, CompletionItemProvider];
20}