diff --git a/_specifications/specification-3-17.md b/_specifications/specification-3-17.md index 795e9712f..e6a92eb39 100644 --- a/_specifications/specification-3-17.md +++ b/_specifications/specification-3-17.md @@ -2050,6 +2050,13 @@ export interface TextDocumentClientCapabilities { * @since 3.16.0 */ moniker?: MonikerClientCapabilities; + + /** + * Capabilities specific to the `textDocument/inlineValues` request. + * + * @since 3.17.0 - proposed state + */ + inlineValues?: InlineValuesClientCapabilities; } ``` @@ -2492,6 +2499,13 @@ interface ServerCapabilities { */ monikerProvider?: boolean | MonikerOptions | MonikerRegistrationOptions; + /** + * The server provides inline values. + * + * @since 3.17.0 - proposed state + */ + inlineValuesProvider?: InlineValuesOptions; + /** * The server provides workspace symbol support. */ @@ -8901,6 +8915,162 @@ export interface Moniker { Server implementations of this method should ensure that the moniker calculation matches to those used in the corresponding LSIF implementation to ensure symbols can be associated correctly across IDE sessions and LSIF indexes. +#### Inline Values Request (:leftwards_arrow_with_hook:) + +> *Since version 3.17.0* + +The inline values 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. + +_Client Capability_: +* property name (optional): `textDocument.inlineValues` +* property type: `InlineValuesClientCapabilities` defined as follows: + +
+ +```typescript +/** + * Client capabilities specific to inline values. + */ +export interface InlineValuesClientCapabilities { + /** + * Whether inline values supports dynamic registration. + */ + dynamicRegistration?: boolean; +} +``` + +_Server Capability_: +* property name (optional): `inlineValuesProvider` +* property type: `InlineValuesOptions` defined as follows: + + + +```typescript +export interface InlineValuesOptions extends WorkDoneProgressOptions { +} +``` + +_Registration Options_: `InlineValuesRegistrationOptions` defined as follows: + + + +```typescript +export interface InlineValuesRegistrationOptions extends + TextDocumentRegistrationOptions, InlineValuesOptions { +} +``` + +_Request_: +* method: `textDocument/inlineValues` +* params: `InlineValuesParams` defined as follows: + + + +```typescript +interface InlineValuesParams extends WorkDoneProgressParams { + /** + * The document to request inline values for. + */ + readonly textDocument: TextDocumentIdentifier; + + /** + * The visible document range for which inline values should be computed. + */ + readonly viewPort: Range; + + /** + * Additional information about the context in which inline values were + * requested. + */ + readonly context: InlineValuesContext; +} +``` + + + +```typescript +interface InlineValuesContext { + /** + * The document range where execution has stopped. + * Typically the end position of the range denotes the line where the inline values are shown. + */ + readonly stoppedLocation: Range; +} +``` + +_Response_: +* result: `InlineValue[]` \| `null` defined as follows: + + + +```typescript +/** + * Inline value information can be provided by different means: + * - directly as a text value (class InlineValueText). + * - as a name to use for a variable lookup (class InlineValueVariableLookup) + * - as an evaluatable expression (class InlineValueEvaluatableExpression) + * The InlineValue types combines all inline value types into one type. + */ +export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression; + +/** + * Provide inline value as text. + */ +export class InlineValueText { + /** + * The document range for which the inline value applies. + */ + readonly range: Range; + + /** + * The text of the inline value. + */ + readonly text: string; +} + +/** + * Provide inline value through a variable lookup. + * If only a range is specified, the variable name will be extracted from the underlying document. + * An optional variable name can be used to override the extracted name. + */ +export class InlineValueVariableLookup { + /** + * The document range for which the inline value applies. + * The range is used to extract the variable name from the underlying document. + */ + readonly range: Range; + + /** + * If specified the name of the variable to look up. + */ + readonly variableName?: string; + + /** + * How to perform the lookup. + */ + readonly caseSensitiveLookup: boolean; +} + +/** + * Provide an inline value through an expression evaluation. + * If only a range is specified, the expression will be extracted from the underlying document. + * An optional expression can be used to override the extracted expression. + */ +export class InlineValueEvaluatableExpression { + /** + * The document range for which the inline value applies. + * The range is used to extract the evaluatable expression from the underlying document. + */ + readonly range: Range; + + /** + * If specified the expression overrides the extracted expression. + */ + readonly expression?: string; +} +``` +* error: code and message set in case an exception happens during the inline values request. + ### Implementation Considerations Language servers usually run in a separate process and client communicate with them in an asynchronous fashion. Additionally clients usually allow users to interact with the source code even if request results are pending. We recommend the following implementation pattern to avoid that clients apply outdated response results: @@ -8926,6 +9096,7 @@ To support the case that the editor starting a server crashes an editor should a #### 3.17.0 (xx/xx/xxxx) * Add support for a completion item label details. +* Add support for `textDocument/inlineValues` request (proposed). #### 3.16.0 (12/14/2020)