Skip to content

Commit e31b4a2

Browse files
committed
Add Inline Value to specification
1 parent c63b5f5 commit e31b4a2

File tree

4 files changed

+270
-1
lines changed

4 files changed

+270
-1
lines changed

_data/linkableTypes.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,4 +723,24 @@
723723
- type: 'InlayHintKind'
724724
link: '#inlayHintKind'
725725
- type: 'InlayHintWorkspaceClientCapabilities'
726-
link: '#inlayHintWorkspaceClientCapabilities'
726+
link: '#inlayHintWorkspaceClientCapabilities'
727+
- type: 'InlineValueClientCapabilities'
728+
link: '#inlineValueClientCapabilities'
729+
- type: 'InlineValueOptions'
730+
link: '#inlineValueOptions'
731+
- type: 'InlineValueRegistrationOptions'
732+
link: '#inlineValueRegistrationOptions'
733+
- type: 'InlineValueParams'
734+
link: '#inlineValueParams'
735+
- type: 'InlineValueContext'
736+
link: '#inlineValueContext'
737+
- type: 'InlineValueText'
738+
link: '#inlineValueText'
739+
- type: 'InlineValueVariableLookup'
740+
link: '#inlineValueVariableLookup'
741+
- type: 'InlineValueEvaluatableExpression'
742+
link: '#inlineValueEvaluatableExpression'
743+
- type: 'InlineValue'
744+
link: '#inlineValue'
745+
- type: 'InlineValueWorkspaceClientCapabilities'
746+
link: '#inlineValueWorkspaceClientCapabilities'

_data/specification-3-17-toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@
167167
anchor: textDocument_documentSymbol
168168
- title: Semantic Tokens
169169
anchor: textDocument_semanticTokens
170+
- title: Inline Value
171+
anchor: textDocument_inlineValue
172+
- title: Inline Value Refresh
173+
anchor: workspace_inlineValue_refresh
170174
- title: Inlay Hint
171175
anchor: textDocument_inlayHint
172176
- title: Inlay Hint Resolve
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
#### <a href="#textDocument_inlineValue" name="textDocument_inlineValue" class="anchor">Inline Value Request (:leftwards_arrow_with_hook:)</a>
2+
3+
> *Since version 3.17.0*
4+
5+
The inline value request is sent from the client to the server to compute inline values for a given text document that may be rendered in the editor at the end of lines.
6+
7+
_Client Capability_:
8+
* property name (optional): `textDocument.inlineValue`
9+
* property type: `InlineValueClientCapabilities` defined as follows:
10+
11+
<div class="anchorHolder"><a href="#inlineValueClientCapabilities" name="inlineValueClientCapabilities" class="linkableAnchor"></a></div>
12+
13+
```typescript
14+
/**
15+
* Client capabilities specific to inline values.
16+
*
17+
* @since 3.17.0 - proposed state
18+
*/
19+
export type InlineValueClientCapabilities = {
20+
/**
21+
* Whether implementation supports dynamic registration for inline
22+
* value providers.
23+
*/
24+
dynamicRegistration?: boolean;
25+
};
26+
```
27+
28+
_Server Capability_:
29+
* property name (optional): `inlineValueProvider`
30+
* property type: `InlineValueOptions` defined as follows:
31+
32+
<div class="anchorHolder"><a href="#inlineValueOptions" name="inlineValueOptions" class="linkableAnchor"></a></div>
33+
34+
```typescript
35+
/**
36+
* Inline value options used during static registration.
37+
*
38+
* @since 3.17.0 - proposed state
39+
*/
40+
export type InlineValueOptions = WorkDoneProgressOptions;
41+
```
42+
43+
_Registration Options_: `InlineValueRegistrationOptions` defined as follows:
44+
45+
<div class="anchorHolder"><a href="#inlineValueRegistrationOptions" name="inlineValueRegistrationOptions" class="linkableAnchor"></a></div>
46+
47+
```typescript
48+
/**
49+
* Inline value options used during static or dynamic registration.
50+
*
51+
* @since 3.17.0 - proposed state
52+
*/
53+
export type InlineValueRegistrationOptions = InlineValueOptions
54+
& TextDocumentRegistrationOptions & StaticRegistrationOptions;
55+
```
56+
57+
_Request_:
58+
* method: `textDocument/inlineValue`
59+
* params: `InlineValueParams` defined as follows:
60+
61+
<div class="anchorHolder"><a href="#inlineValueParams" name="inlineValueParams" class="linkableAnchor"></a></div>
62+
63+
```typescript
64+
/**
65+
* A parameter literal used in inline value requests.
66+
*
67+
* @since 3.17.0 - proposed state
68+
*/
69+
export type InlineValueParams = WorkDoneProgressParams & {
70+
/**
71+
* The text document.
72+
*/
73+
textDocument: TextDocumentIdentifier;
74+
75+
/**
76+
* The document range for which inline values should be computed.
77+
*/
78+
range: Range;
79+
80+
/**
81+
* Additional information about the context in which inline values were
82+
* requested.
83+
*/
84+
context: InlineValueContext;
85+
};
86+
```
87+
88+
<div class="anchorHolder"><a href="#inlineValueContext" name="inlineValueContext" class="linkableAnchor"></a></div>
89+
90+
```typescript
91+
/**
92+
* @since 3.17.0 - proposed state
93+
*/
94+
export type InlineValueContext = {
95+
/**
96+
* The document range where execution has stopped.
97+
* Typically the end position of the range denotes the line where the
98+
* inline values are shown.
99+
*/
100+
stoppedLocation: Range;
101+
};
102+
```
103+
104+
_Response_:
105+
* result: `InlineValue[]` \| `null` defined as follows:
106+
107+
<div class="anchorHolder"><a href="#inlineValueText" name="inlineValueText" class="linkableAnchor"></a></div>
108+
109+
```typescript
110+
/**
111+
* Provide inline value as text.
112+
*
113+
* @since 3.17.0 - proposed state
114+
*/
115+
export type InlineValueText = {
116+
/**
117+
* The document range for which the inline value applies.
118+
*/
119+
range: Range;
120+
121+
/**
122+
* The text of the inline value.
123+
*/
124+
text: string;
125+
};
126+
```
127+
128+
<div class="anchorHolder"><a href="#inlineValueVariableLookup" name="inlineValueVariableLookup" class="linkableAnchor"></a></div>
129+
130+
```typescript
131+
/**
132+
* Provide inline value through a variable lookup.
133+
*
134+
* If only a range is specified, the variable name will be extracted from
135+
* the underlying document.
136+
*
137+
* An optional variable name can be used to override the extracted name.
138+
*
139+
* @since 3.17.0 - proposed state
140+
*/
141+
export type InlineValueVariableLookup = {
142+
/**
143+
* The document range for which the inline value applies.
144+
* The range is used to extract the variable name from the underlying
145+
* document.
146+
*/
147+
range: Range;
148+
149+
/**
150+
* If specified the name of the variable to look up.
151+
*/
152+
variableName?: string;
153+
154+
/**
155+
* How to perform the lookup.
156+
*/
157+
caseSensitiveLookup: boolean;
158+
};
159+
```
160+
161+
<div class="anchorHolder"><a href="#inlineValueEvaluatableExpression" name="inlineValueEvaluatableExpression" class="linkableAnchor"></a></div>
162+
163+
```typescript
164+
/**
165+
* Provide an inline value through an expression evaluation.
166+
*
167+
* If only a range is specified, the expression will be extracted from the
168+
* underlying document.
169+
*
170+
* An optional expression can be used to override the extracted expression.
171+
*
172+
* @since 3.17.0 - proposed state
173+
*/
174+
export type InlineValueEvaluatableExpression = {
175+
/**
176+
* The document range for which the inline value applies.
177+
* The range is used to extract the evaluatable expression from the
178+
* underlying document.
179+
*/
180+
range: Range;
181+
182+
/**
183+
* If specified the expression overrides the extracted expression.
184+
*/
185+
expression?: string;
186+
};
187+
```
188+
189+
<div class="anchorHolder"><a href="#inlineValue" name="inlineValue" class="linkableAnchor"></a></div>
190+
191+
```typescript
192+
/**
193+
* Inline value information can be provided by different means:
194+
* - directly as a text value (class InlineValueText).
195+
* - as a name to use for a variable lookup (class InlineValueVariableLookup)
196+
* - as an evaluatable expression (class InlineValueEvaluatableExpression)
197+
* The InlineValue types combines all inline value types into one type.
198+
*
199+
* @since 3.17.0 - proposed state
200+
*/
201+
export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;
202+
```
203+
* error: code and message set in case an exception happens during the inline values request.
204+
205+
#### <a href="#workspace_inlineValue_refresh" name="workspace_inlineValue_refresh" class="anchor">Inline Value Refresh Request (:arrow_right_hook:)</a>
206+
207+
> *Since version 3.17.0*
208+
209+
The `workspace/inlineValue/refresh` request is sent from the server to the client. Servers can use it to ask clients to refresh the inline values currently shown in editors. As a result the client should ask the server to recompute the inline values for these editors. This is useful if a server detects a configuration change which requires a re-calculation of all inline values. Note that the client still has the freedom to delay the re-calculation of the inline values if for example an editor is currently not visible.
210+
211+
_Client Capability_:
212+
213+
* property name (optional): `workspace.inlineValue`
214+
* property type: `InlineValueWorkspaceClientCapabilities` defined as follows:
215+
216+
<div class="anchorHolder"><a href="#inlineValueWorkspaceClientCapabilities" name="inlineValueWorkspaceClientCapabilities" class="linkableAnchor"></a></div>
217+
218+
```typescript
219+
/**
220+
* Client workspace capabilities specific to inline values.
221+
*
222+
* @since 3.17.0 - proposed state
223+
*/
224+
export type InlineValueWorkspaceClientCapabilities = {
225+
/**
226+
* Whether the client implementation supports a refresh request sent from
227+
* the server to the client.
228+
*
229+
* Note that this event is global and will force the client to refresh all
230+
* inline values currently shown. It should be used with absolute care and
231+
* is useful for situation where a server for example detect a project wide
232+
* change that requires such a calculation.
233+
*/
234+
refreshSupport?: boolean;
235+
};
236+
```
237+
_Request_:
238+
* method: `workspace/inlineValue/refresh`
239+
* params: none
240+
241+
_Response_:
242+
243+
* result: void
244+
* error: code and message set in case an exception happens during the 'workspace/inlineValue/refresh' request

_specifications/lsp/3.17/specification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ Language Feature provide the actual smarts in the language server protocol. The
664664
{% include_relative language/documentSymbol.md %}
665665
{% include_relative language/semanticTokens.md %}
666666
{% include_relative language/inlayHint.md %}
667+
{% include_relative language/inlineValue.md %}
667668
{% include_relative language/moniker.md %}
668669
{% include_relative language/completion.md %}
669670
{% include_relative language/publishDiagnostics.md %}

0 commit comments

Comments
 (0)