Goto Type Definition 请求
从版本 3.6.0 开始
转到类型定义请求从客户端发送到服务器,以解析给定文本文档位置处符号的类型定义位置。
结果类型 LocationLink[]
是在 3.14.0 版中引入的,它依赖于相应的客户端功能 textDocument.typeDefinition.linkSupport
。
客户端能力(Client capability):
- 属性路径:
textDocument.typeDefinition
- 属性类型:
TypeDefinitionClientCapabilities
, 定义如下:
export interface TypeDefinitionClientCapabilities {
/**
* Whether implementation supports dynamic registration. If this is set to
* `true` the client supports the new `TypeDefinitionRegistrationOptions`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
/**
* The client supports additional metadata in the form of definition links.
*
* @since 3.14.0
*/
linkSupport?: boolean;
}
服务端能力(Server capability):
- 属性路径:
typeDefinitionProvider
- 属性类型:
boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions
,TypeDefinitionOptions
定义如下:
export interface TypeDefinitionOptions extends WorkDoneProgressOptions {
}
注册选项(Registration Options): TypeDefinitionRegistrationOptions
, 定义如下:
export interface TypeDefinitionRegistrationOptions extends
TextDocumentRegistrationOptions, TypeDefinitionOptions,
StaticRegistrationOptions {
}
请求(Request):
- method: "textDocument/typeDefinition"
- params:
TypeDefinitionParams
, 定义如下:
export interface TypeDefinitionParams extends TextDocumentPositionParams,
WorkDoneProgressParams, PartialResultParams {
}
响应(Response):
- result:
Location | Location[] | LocationLink[] | null
- partial result:
Location[] | LocationLink[]
- error:
code
和message
,以防在请求期间发生异常。