-
Notifications
You must be signed in to change notification settings - Fork 328
/
protocol.colorProvider.ts
84 lines (71 loc) · 3.32 KB
/
protocol.colorProvider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { RequestHandler, ProgressType } from 'vscode-jsonrpc';
import { TextDocumentIdentifier, Range, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { ProtocolRequestType } from './messages';
import { TextDocumentRegistrationOptions, StaticRegistrationOptions, PartialResultParams, WorkDoneProgressParams, WorkDoneProgressOptions } from './protocol';
//---- Client capability ----
export interface DocumentColorClientCapabilities {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `DocumentColorRegistrationOptions` return value
* for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
}
export interface DocumentColorOptions extends WorkDoneProgressOptions {
}
export interface DocumentColorRegistrationOptions extends TextDocumentRegistrationOptions, StaticRegistrationOptions, DocumentColorOptions {
}
//---- Color Symbol Provider ---------------------------
/**
* Parameters for a [DocumentColorRequest](#DocumentColorRequest).
*/
export interface DocumentColorParams extends WorkDoneProgressParams, PartialResultParams {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
}
/**
* A request to list all color symbols found in a given text document. The request's
* parameter is of type [DocumentColorParams](#DocumentColorParams) the
* response is of type [ColorInformation[]](#ColorInformation) or a Thenable
* that resolves to such.
*/
export namespace DocumentColorRequest {
export const method: 'textDocument/documentColor' = 'textDocument/documentColor';
export const type = new ProtocolRequestType<DocumentColorParams, ColorInformation[], ColorInformation[], void, DocumentColorRegistrationOptions>(method);
/** @deprecated Use DocumentColorRequest.type */
export const resultType = new ProgressType<ColorInformation[]>();
export type HandlerSignature = RequestHandler<DocumentColorParams, ColorInformation[], void>;
}
/**
* Parameters for a [ColorPresentationRequest](#ColorPresentationRequest).
*/
export interface ColorPresentationParams extends WorkDoneProgressParams, PartialResultParams {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
/**
* The color to request presentations for.
*/
color: Color
/**
* The range where the color would be inserted. Serves as a context.
*/
range: Range;
}
/**
* A request to list all presentation for a color. The request's
* parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
* response is of type [ColorInformation[]](#ColorInformation) or a Thenable
* that resolves to such.
*/
export namespace ColorPresentationRequest {
export const type = new ProtocolRequestType<ColorPresentationParams, ColorPresentation[], ColorPresentation[], void, WorkDoneProgressOptions & TextDocumentRegistrationOptions>('textDocument/colorPresentation');
export type HandlerSignature = RequestHandler<ColorPresentationParams, ColorPresentation[], void>;
}