Inline Value
Inline Value 请求
从版本 3.17.0 开始
内联值请求从客户端发送到服务器,以计算给定文本文档的内联值,该文本文档可能在编辑器中的行尾呈现。
客户端能力(Client capability):
- 属性路径:
textDocument.inlineValue
- 属性类型:
InlineValueClientCapabilities
, 定义如下:
/**
* Client capabilities specific to inline values.
*
* @since 3.17.0
*/
export interface InlineValueClientCapabilities {
/**
* Whether implementation supports dynamic registration for inline
* value providers.
*/
dynamicRegistration?: boolean;
}
服务端能力(Server capability):
- 属性路径:
inlineValueProvider
- 属性类型:
InlineValueOptions
, 定义如下:
/**
* Inline value options used during static registration.
*
* @since 3.17.0
*/
export interface InlineValueOptions extends WorkDoneProgressOptions {
}
注册选项(Registration Options): InlineValueRegistrationOptions
, 定义如下:
/**
* Inline value options used during static or dynamic registration.
*
* @since 3.17.0
*/
export interface InlineValueRegistrationOptions extends InlineValueOptions,
TextDocumentRegistrationOptions, StaticRegistrationOptions {
}
请求(Request):
- method: "textDocument/inlineValue"
- params:
InlineValueParams
, 定义如下:
/**
* A parameter literal used in inline value requests.
*
* @since 3.17.0
*/
export interface InlineValueParams extends WorkDoneProgressParams {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
/**
* The document range for which inline values should be computed.
*/
range: Range;
/**
* Additional information about the context in which inline values were
* requested.
*/
context: InlineValueContext;
}
/**
* @since 3.17.0
*/
export interface InlineValueContext {
/**
* The stack frame (as a DAP Id) where the execution has stopped.
*/
frameId: integer;
/**
* The document range where execution has stopped.
* Typically the end position of the range denotes the line where the
* inline values are shown.
*/
stoppedLocation: Range;
}
响应(Response):
- result:
InlineValue[] | null
, 定义如下:
/**
* 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.
*
* @since 3.17.0
*/
export type InlineValue = InlineValueText | InlineValueVariableLookup
| InlineValueEvaluatableExpression;
/**
* Provide inline value as text.
*
* @since 3.17.0
*/
export interface InlineValueText {
/**
* The document range for which the inline value applies.
*/
range: Range;
/**
* The text of the inline value.
*/
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.
*
* @since 3.17.0
*/
export interface InlineValueVariableLookup {
/**
* The document range for which the inline value applies.
* The range is used to extract the variable name from the underlying
* document.
*/
range: Range;
/**
* If specified the name of the variable to look up.
*/
variableName?: string;
/**
* How to perform the lookup.
*/
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.
*
* @since 3.17.0
*/
export interface InlineValueEvaluatableExpression {
/**
* The document range for which the inline value applies.
* The range is used to extract the evaluatable expression from the
* underlying document.
*/
range: Range;
/**
* If specified the expression overrides the extracted expression.
*/
expression?: string;
}
Inline Value Refresh 请求
从版本 3.17.0 开始
请求从服务器发送到客户端。服务器可以使用它来要求客户端刷新当前显示在编辑器中的内联值。因此,客户端应要求服务器重新计算这些编辑器的内联值。如果服务器检测到需要重新计算所有内联值的配置更改,这将非常有用。请注意,例如,如果编辑器当前不可见,客户端仍然可以自由延迟内联值的重新计算。
客户端能力(Client capability):
- 属性路径:
workspace.inlineValue
- 属性类型:
InlineValueWorkspaceClientCapabilities
, 定义如下:
/**
* Client workspace capabilities specific to inline values.
*
* @since 3.17.0
*/
export interface InlineValueWorkspaceClientCapabilities {
/**
* Whether the client implementation supports a refresh request sent from
* the server to the client.
*
* Note that this event is global and will force the client to refresh all
* inline values currently shown. It should be used with absolute care and
* is useful for situation where a server for example detect a project wide
* change that requires such a calculation.
*/
refreshSupport?: boolean;
}
请求(Request):
- method: "workspace/inlineValue/refresh"
- params: none
响应(Response):
- result: void
- error:
code
和message
,以防在请求期间发生异常。