UNPKG

4.07 kBTypeScriptView Raw
1import { RequestHandler, RequestHandler0 } from 'vscode-jsonrpc';
2import { TextDocumentIdentifier, uinteger, FoldingRange, FoldingRangeKind } from 'vscode-languageserver-types';
3import { MessageDirection, ProtocolRequestType, ProtocolRequestType0 } from './messages';
4import type { TextDocumentRegistrationOptions, StaticRegistrationOptions, PartialResultParams, WorkDoneProgressParams, WorkDoneProgressOptions } from './protocol';
5export interface FoldingRangeClientCapabilities {
6 /**
7 * Whether implementation supports dynamic registration for folding range
8 * providers. If this is set to `true` the client supports the new
9 * `FoldingRangeRegistrationOptions` return value for the corresponding
10 * server capability as well.
11 */
12 dynamicRegistration?: boolean;
13 /**
14 * The maximum number of folding ranges that the client prefers to receive
15 * per document. The value serves as a hint, servers are free to follow the
16 * limit.
17 */
18 rangeLimit?: uinteger;
19 /**
20 * If set, the client signals that it only supports folding complete lines.
21 * If set, client will ignore specified `startCharacter` and `endCharacter`
22 * properties in a FoldingRange.
23 */
24 lineFoldingOnly?: boolean;
25 /**
26 * Specific options for the folding range kind.
27 *
28 * @since 3.17.0
29 */
30 foldingRangeKind?: {
31 /**
32 * The folding range kind values the client supports. When this
33 * property exists the client also guarantees that it will
34 * handle values outside its set gracefully and falls back
35 * to a default value when unknown.
36 */
37 valueSet?: FoldingRangeKind[];
38 };
39 /**
40 * Specific options for the folding range.
41 *
42 * @since 3.17.0
43 */
44 foldingRange?: {
45 /**
46 * If set, the client signals that it supports setting collapsedText on
47 * folding ranges to display custom labels instead of the default text.
48 *
49 * @since 3.17.0
50 */
51 collapsedText?: boolean;
52 };
53}
54/**
55 * Client workspace capabilities specific to folding ranges
56 *
57 * @since 3.18.0
58 * @proposed
59 */
60export interface FoldingRangeWorkspaceClientCapabilities {
61 /**
62 * Whether the client implementation supports a refresh request sent from the
63 * server to the client.
64 *
65 * Note that this event is global and will force the client to refresh all
66 * folding ranges currently shown. It should be used with absolute care and is
67 * useful for situation where a server for example detects a project wide
68 * change that requires such a calculation.
69 *
70 * @since 3.18.0
71 * @proposed
72 */
73 refreshSupport?: boolean;
74}
75export interface FoldingRangeOptions extends WorkDoneProgressOptions {
76}
77export interface FoldingRangeRegistrationOptions extends TextDocumentRegistrationOptions, FoldingRangeOptions, StaticRegistrationOptions {
78}
79/**
80 * Parameters for a {@link FoldingRangeRequest}.
81 */
82export interface FoldingRangeParams extends WorkDoneProgressParams, PartialResultParams {
83 /**
84 * The text document.
85 */
86 textDocument: TextDocumentIdentifier;
87}
88/**
89 * A request to provide folding ranges in a document. The request's
90 * parameter is of type {@link FoldingRangeParams}, the
91 * response is of type {@link FoldingRangeList} or a Thenable
92 * that resolves to such.
93 */
94export declare namespace FoldingRangeRequest {
95 const method: 'textDocument/foldingRange';
96 const messageDirection: MessageDirection;
97 const type: ProtocolRequestType<FoldingRangeParams, FoldingRange[] | null, FoldingRange[], void, FoldingRangeRegistrationOptions>;
98 type HandlerSignature = RequestHandler<FoldingRangeParams, FoldingRange[] | null, void>;
99}
100/**
101 * @since 3.18.0
102 * @proposed
103 */
104export declare namespace FoldingRangeRefreshRequest {
105 const method: `workspace/foldingRange/refresh`;
106 const messageDirection: MessageDirection;
107 const type: ProtocolRequestType0<void, void, void, void>;
108 type HandlerSignature = RequestHandler0<void, void>;
109}