UNPKG

1.81 kBTypeScriptView Raw
1import { Disposable, TextDocument, ProviderResult, Range as VRange, Color as VColor, ColorPresentation as VColorPresentation, ColorInformation as VColorInformation, DocumentColorProvider } from 'vscode';
2import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, DocumentColorRegistrationOptions, DocumentColorOptions } from 'vscode-languageserver-protocol';
3import { TextDocumentLanguageFeature, FeatureClient } from './features';
4export interface ProvideDocumentColorsSignature {
5 (document: TextDocument, token: CancellationToken): ProviderResult<VColorInformation[]>;
6}
7export interface ProvideColorPresentationSignature {
8 (color: VColor, context: {
9 document: TextDocument;
10 range: VRange;
11 }, token: CancellationToken): ProviderResult<VColorPresentation[]>;
12}
13export interface ColorProviderMiddleware {
14 provideDocumentColors?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideDocumentColorsSignature) => ProviderResult<VColorInformation[]>;
15 provideColorPresentations?: (this: void, color: VColor, context: {
16 document: TextDocument;
17 range: VRange;
18 }, token: CancellationToken, next: ProvideColorPresentationSignature) => ProviderResult<VColorPresentation[]>;
19}
20export declare class ColorProviderFeature extends TextDocumentLanguageFeature<boolean | DocumentColorOptions, DocumentColorRegistrationOptions, DocumentColorProvider, ColorProviderMiddleware> {
21 constructor(client: FeatureClient<ColorProviderMiddleware>);
22 fillClientCapabilities(capabilities: ClientCapabilities): void;
23 initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
24 protected registerLanguageProvider(options: DocumentColorRegistrationOptions): [Disposable, DocumentColorProvider];
25}