1 import { TextDocumentIdentifier, Range, uinteger } from 'vscode-languageserver-types';
2 import { RequestHandler0, RequestHandler } from 'vscode-jsonrpc';
3 import { ProtocolRequestType, ProtocolRequestType0, RegistrationType } from './messages';
4 import { PartialResultParams, WorkDoneProgressParams, WorkDoneProgressOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions } from './protocol';
6 * A set of predefined token types. This set is not fixed
7 * an clients can specify additional token types via the
8 * corresponding client capabilities.
12 export declare enum SemanticTokenTypes {
13 namespace = "namespace",
15 * Represents a generic type. Acts as a fallback for types which can't be mapped to
16 * a specific type like class or enum.
21 interface = "interface",
23 typeParameter = "typeParameter",
24 parameter = "parameter",
25 variable = "variable",
26 property = "property",
27 enumMember = "enumMember",
29 function = "function",
33 modifier = "modifier",
41 * A set of predefined token modifiers. This set is not fixed
42 * an clients can specify additional token types via the
43 * corresponding client capabilities.
47 export declare enum SemanticTokenModifiers {
48 declaration = "declaration",
49 definition = "definition",
50 readonly = "readonly",
52 deprecated = "deprecated",
53 abstract = "abstract",
55 modification = "modification",
56 documentation = "documentation",
57 defaultLibrary = "defaultLibrary"
62 export interface SemanticTokensLegend {
64 * The token types a server uses.
68 * The token modifiers a server uses.
70 tokenModifiers: string[];
75 export interface SemanticTokens {
77 * An optional result id. If provided and clients support delta updating
78 * the client will include the result id in the next semantic token request.
79 * A server can then instead of computing all semantic tokens again simply
91 export declare namespace SemanticTokens {
92 function is(value: any): value is SemanticTokens;
97 export interface SemanticTokensPartialResult {
103 export interface SemanticTokensEdit {
105 * The start offset of the edit.
109 * The count of elements to remove.
111 deleteCount: uinteger;
113 * The elements to insert.
120 export interface SemanticTokensDelta {
121 readonly resultId?: string;
123 * The semantic token edits to transform a previous result into a new result.
125 edits: SemanticTokensEdit[];
130 export interface SemanticTokensDeltaPartialResult {
131 edits: SemanticTokensEdit[];
133 export declare namespace TokenFormat {
134 const Relative: 'relative';
136 export declare type TokenFormat = 'relative';
140 export interface SemanticTokensClientCapabilities {
142 * Whether implementation supports dynamic registration. If this is set to `true`
143 * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
144 * return value for the corresponding server capability as well.
146 dynamicRegistration?: boolean;
148 * Which requests the client supports and might send to the server
149 * depending on the server's capability. Please note that clients might not
150 * show semantic tokens or degrade some of the user experience if a range
151 * or full request is advertised by the client but not provided by the
152 * server. If for example the client capability `requests.full` and
153 * `request.range` are both set to true but the server only provides a
154 * range provider the client might not render a minimap correctly or might
155 * even decide to not show any semantic tokens at all.
159 * The client will send the `textDocument/semanticTokens/range` request if
160 * the server provides a corresponding handler.
162 range?: boolean | {};
164 * The client will send the `textDocument/semanticTokens/full` request if
165 * the server provides a corresponding handler.
169 * The client will send the `textDocument/semanticTokens/full/delta` request if
170 * the server provides a corresponding handler.
176 * The token types that the client supports.
178 tokenTypes: string[];
180 * The token modifiers that the client supports.
182 tokenModifiers: string[];
184 * The token formats the clients supports.
186 formats: TokenFormat[];
188 * Whether the client supports tokens that can overlap each other.
190 overlappingTokenSupport?: boolean;
192 * Whether the client supports tokens that can span multiple lines.
194 multilineTokenSupport?: boolean;
199 export interface SemanticTokensOptions extends WorkDoneProgressOptions {
201 * The legend used by the server
203 legend: SemanticTokensLegend;
205 * Server supports providing semantic tokens for a specific range
208 range?: boolean | {};
210 * Server supports providing semantic tokens for a full document.
214 * The server supports deltas for full documents.
222 export interface SemanticTokensRegistrationOptions extends TextDocumentRegistrationOptions, SemanticTokensOptions, StaticRegistrationOptions {
224 export declare namespace SemanticTokensRegistrationType {
225 const method: 'textDocument/semanticTokens';
226 const type: RegistrationType<SemanticTokensRegistrationOptions>;
231 export interface SemanticTokensParams extends WorkDoneProgressParams, PartialResultParams {
235 textDocument: TextDocumentIdentifier;
240 export declare namespace SemanticTokensRequest {
241 const method: 'textDocument/semanticTokens/full';
242 const type: ProtocolRequestType<SemanticTokensParams, SemanticTokens | null, SemanticTokensPartialResult, void, SemanticTokensRegistrationOptions>;
243 type HandlerSignature = RequestHandler<SemanticTokensDeltaParams, SemanticTokens | null, void>;
248 export interface SemanticTokensDeltaParams extends WorkDoneProgressParams, PartialResultParams {
252 textDocument: TextDocumentIdentifier;
254 * The result id of a previous response. The result Id can either point to a full response
255 * or a delta response depending on what was received last.
257 previousResultId: string;
262 export declare namespace SemanticTokensDeltaRequest {
263 const method: 'textDocument/semanticTokens/full/delta';
264 const type: ProtocolRequestType<SemanticTokensDeltaParams, SemanticTokens | SemanticTokensDelta | null, SemanticTokensPartialResult | SemanticTokensDeltaPartialResult, void, SemanticTokensRegistrationOptions>;
265 type HandlerSignature = RequestHandler<SemanticTokensDeltaParams, SemanticTokens | SemanticTokensDelta | null, void>;
270 export interface SemanticTokensRangeParams extends WorkDoneProgressParams, PartialResultParams {
274 textDocument: TextDocumentIdentifier;
276 * The range the semantic tokens are requested for.
283 export declare namespace SemanticTokensRangeRequest {
284 const method: 'textDocument/semanticTokens/range';
285 const type: ProtocolRequestType<SemanticTokensRangeParams, SemanticTokens | null, SemanticTokensPartialResult, void, void>;
286 type HandlerSignature = RequestHandler<SemanticTokensRangeParams, SemanticTokens | null, void>;
288 export interface SemanticTokensWorkspaceClientCapabilities {
290 * Whether the client implementation supports a refresh request sent from
291 * the server to the client.
293 * Note that this event is global and will force the client to refresh all
294 * semantic tokens currently shown. It should be used with absolute care
295 * and is useful for situation where a server for example detect a project
296 * wide change that requires such a calculation.
298 refreshSupport?: boolean;
303 export declare namespace SemanticTokensRefreshRequest {
304 const method: `workspace/semanticTokens/refresh`;
305 const type: ProtocolRequestType0<void, void, void, void>;
306 type HandlerSignature = RequestHandler0<void, void>;