Linked Editing Range
从版本 3.16.0 开始
链接的编辑请求从客户端发送到服务器,以返回文档中给定位置的符号范围以及具有相同内容的所有范围。(可选)可以返回单词模式来描述有效内容。如果新内容有效,则可以将其中一个范围的重命名应用于所有其他范围。如果未提供特定于结果的词模式,则使用客户端语言配置中的字模式。
客户端能力(Client capability):
- 属性路径:
textDocument.linkedEditingRange
- 属性类型:
LinkedEditingRangeClientCapabilities
, 定义如下:
export interface LinkedEditingRangeClientCapabilities {
/**
* Whether the implementation supports dynamic registration.
* If this is set to `true` the client supports the new
* `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
}
服务端能力(Server capability):
- 属性路径:
linkedEditingRangeProvider
- 属性类型:
boolean | LinkedEditingRangeOptions | LinkedEditingRangeRegistrationOptions
, 定义如下:
export interface LinkedEditingRangeOptions extends WorkDoneProgressOptions {
}
注册选项(Registration Options): LinkedEditingRangeRegistrationOptions
, 定义如下:
export interface LinkedEditingRangeRegistrationOptions extends
TextDocumentRegistrationOptions, LinkedEditingRangeOptions,
StaticRegistrationOptions {
}
请求(Request):
- method: "textDocument/linkedEditingRange"
- params:
LinkedEditingRangeParams
, 定义如下:
export interface LinkedEditingRangeParams extends TextDocumentPositionParams,
WorkDoneProgressParams {
}
响应(Response):
- result:
LinkedEditingRanges | null
, 定义如下:
export interface LinkedEditingRanges {
/**
* A list of ranges that can be renamed together. The ranges must have
* identical length and contain identical text content. The ranges cannot
* overlap.
*/
ranges: Range[];
/**
* An optional word pattern (regular expression) that describes valid
* contents for the given ranges. If no pattern is provided, the client
* configuration's word pattern will be used.
*/
wordPattern?: string;
}
- error:
code
和message
,以防在请求期间发生异常。