UNPKG

2.5 kBTypeScriptView Raw
1import * as vscode from 'vscode';
2import { ClientCapabilities, ServerCapabilities, DocumentSelector, SemanticTokensOptions, SemanticTokensRegistrationOptions } from 'vscode-languageserver-protocol';
3import { FeatureClient, TextDocumentLanguageFeature } from './features';
4export interface DocumentSemanticsTokensSignature {
5 (this: void, document: vscode.TextDocument, token: vscode.CancellationToken): vscode.ProviderResult<vscode.SemanticTokens>;
6}
7export interface DocumentSemanticsTokensEditsSignature {
8 (this: void, document: vscode.TextDocument, previousResultId: string, token: vscode.CancellationToken): vscode.ProviderResult<vscode.SemanticTokensEdits | vscode.SemanticTokens>;
9}
10export interface DocumentRangeSemanticTokensSignature {
11 (this: void, document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): vscode.ProviderResult<vscode.SemanticTokens>;
12}
13/**
14 * The semantic token middleware
15 *
16 * @since 3.16.0
17 */
18export interface SemanticTokensMiddleware {
19 provideDocumentSemanticTokens?: (this: void, document: vscode.TextDocument, token: vscode.CancellationToken, next: DocumentSemanticsTokensSignature) => vscode.ProviderResult<vscode.SemanticTokens>;
20 provideDocumentSemanticTokensEdits?: (this: void, document: vscode.TextDocument, previousResultId: string, token: vscode.CancellationToken, next: DocumentSemanticsTokensEditsSignature) => vscode.ProviderResult<vscode.SemanticTokensEdits | vscode.SemanticTokens>;
21 provideDocumentRangeSemanticTokens?: (this: void, document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken, next: DocumentRangeSemanticTokensSignature) => vscode.ProviderResult<vscode.SemanticTokens>;
22}
23export interface SemanticTokensProviderShape {
24 range?: vscode.DocumentRangeSemanticTokensProvider;
25 full?: vscode.DocumentSemanticTokensProvider;
26 onDidChangeSemanticTokensEmitter: vscode.EventEmitter<void>;
27}
28export declare class SemanticTokensFeature extends TextDocumentLanguageFeature<boolean | SemanticTokensOptions, SemanticTokensRegistrationOptions, SemanticTokensProviderShape, SemanticTokensMiddleware> {
29 constructor(client: FeatureClient<SemanticTokensMiddleware>);
30 fillClientCapabilities(capabilities: ClientCapabilities): void;
31 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
32 protected registerLanguageProvider(options: SemanticTokensRegistrationOptions): [vscode.Disposable, SemanticTokensProviderShape];
33}