UNPKG

1.79 kBTypeScriptView Raw
1import { SemanticTokens, SemanticTokensPartialResult, SemanticTokensDelta, SemanticTokensDeltaPartialResult, SemanticTokensParams, SemanticTokensDeltaParams, SemanticTokensRangeParams, SemanticTokensEdit, Disposable } from 'vscode-languageserver-protocol';
2import type { Feature, _Languages, ServerRequestHandler } from './server';
3/**
4 * Shape of the semantic token feature
5 *
6 * @since 3.16.0
7 */
8export interface SemanticTokensFeatureShape {
9 semanticTokens: {
10 refresh(): void;
11 on(handler: ServerRequestHandler<SemanticTokensParams, SemanticTokens, SemanticTokensPartialResult, void>): Disposable;
12 onDelta(handler: ServerRequestHandler<SemanticTokensDeltaParams, SemanticTokensDelta | SemanticTokens, SemanticTokensDeltaPartialResult | SemanticTokensPartialResult, void>): Disposable;
13 onRange(handler: ServerRequestHandler<SemanticTokensRangeParams, SemanticTokens, SemanticTokensPartialResult, void>): Disposable;
14 };
15}
16export declare const SemanticTokensFeature: Feature<_Languages, SemanticTokensFeatureShape>;
17export declare class SemanticTokensDiff {
18 private readonly originalSequence;
19 private readonly modifiedSequence;
20 constructor(originalSequence: number[], modifiedSequence: number[]);
21 computeDiff(): SemanticTokensEdit[];
22}
23export declare class SemanticTokensBuilder {
24 private _id;
25 private _prevLine;
26 private _prevChar;
27 private _data;
28 private _dataLen;
29 private _prevData;
30 constructor();
31 private initialize;
32 push(line: number, char: number, length: number, tokenType: number, tokenModifiers: number): void;
33 get id(): string;
34 previousResult(id: string): void;
35 build(): SemanticTokens;
36 canBuildEdits(): boolean;
37 buildEdits(): SemanticTokens | SemanticTokensDelta;
38}