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