UNPKG

2.9 kBTypeScriptView Raw
1import { RequestHandler } from 'vscode-jsonrpc';
2import { TextDocumentIdentifier, Range, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
3import { MessageDirection, ProtocolRequestType } from './messages';
4import type { TextDocumentRegistrationOptions, StaticRegistrationOptions, PartialResultParams, WorkDoneProgressParams, WorkDoneProgressOptions } from './protocol';
5export interface DocumentColorClientCapabilities {
6 /**
7 * Whether implementation supports dynamic registration. If this is set to `true`
8 * the client supports the new `DocumentColorRegistrationOptions` return value
9 * for the corresponding server capability as well.
10 */
11 dynamicRegistration?: boolean;
12}
13export interface DocumentColorOptions extends WorkDoneProgressOptions {
14}
15export interface DocumentColorRegistrationOptions extends TextDocumentRegistrationOptions, StaticRegistrationOptions, DocumentColorOptions {
16}
17/**
18 * Parameters for a {@link DocumentColorRequest}.
19 */
20export interface DocumentColorParams extends WorkDoneProgressParams, PartialResultParams {
21 /**
22 * The text document.
23 */
24 textDocument: TextDocumentIdentifier;
25}
26/**
27 * A request to list all color symbols found in a given text document. The request's
28 * parameter is of type {@link DocumentColorParams} the
29 * response is of type {@link ColorInformation ColorInformation[]} or a Thenable
30 * that resolves to such.
31 */
32export declare namespace DocumentColorRequest {
33 const method: 'textDocument/documentColor';
34 const messageDirection: MessageDirection;
35 const type: ProtocolRequestType<DocumentColorParams, ColorInformation[], ColorInformation[], void, DocumentColorRegistrationOptions>;
36 type HandlerSignature = RequestHandler<DocumentColorParams, ColorInformation[], void>;
37}
38/**
39 * Parameters for a {@link ColorPresentationRequest}.
40 */
41export interface ColorPresentationParams extends WorkDoneProgressParams, PartialResultParams {
42 /**
43 * The text document.
44 */
45 textDocument: TextDocumentIdentifier;
46 /**
47 * The color to request presentations for.
48 */
49 color: Color;
50 /**
51 * The range where the color would be inserted. Serves as a context.
52 */
53 range: Range;
54}
55/**
56 * A request to list all presentation for a color. The request's
57 * parameter is of type {@link ColorPresentationParams} the
58 * response is of type {@link ColorInformation ColorInformation[]} or a Thenable
59 * that resolves to such.
60 */
61export declare namespace ColorPresentationRequest {
62 const method: 'textDocument/colorPresentation';
63 const messageDirection: MessageDirection;
64 const type: ProtocolRequestType<ColorPresentationParams, ColorPresentation[], ColorPresentation[], void, WorkDoneProgressOptions & TextDocumentRegistrationOptions>;
65 type HandlerSignature = RequestHandler<ColorPresentationParams, ColorPresentation[], void>;
66}