Document Link

文档链接请求从客户端发送到服务器,以请求文档中链接的位置。

document-link

客户端能力(Client capability):

  • 属性路径: textDocument.documentLink
  • 属性类型: DocumentLinkClientCapabilities, 定义如下:
export interface DocumentLinkClientCapabilities {
	/**
	 * Whether document link supports dynamic registration.
	 */
	dynamicRegistration?: boolean;

	/**
	 * Whether the client supports the `tooltip` property on `DocumentLink`.
	 *
	 * @since 3.15.0
	 */
	tooltipSupport?: boolean;
}

服务端能力(Server capability):

  • 属性路径: documentLinkProvider
  • 属性类型: DocumentLinkOptions, 定义如下:
export interface DocumentLinkOptions extends WorkDoneProgressOptions {
	/**
	 * Document links have a resolve provider as well.
	 */
	resolveProvider?: boolean;
}

注册选项(Registration Options): DocumentLinkRegistrationOptions, 定义如下:

export interface DocumentLinkRegistrationOptions extends
	TextDocumentRegistrationOptions, DocumentLinkOptions {
}

请求(Request):

  • method: "textDocument/documentLink"
  • params: DocumentLinkParams, 定义如下:
interface DocumentLinkParams extends WorkDoneProgressParams,
	PartialResultParams {
	/**
	 * The document to provide document links for.
	 */
	textDocument: TextDocumentIdentifier;
}

响应(Response):

  • result: DocumentLink[] | null, 定义如下:
/**
 * A document link is a range in a text document that links to an internal or
 * external resource, like another text document or a web site.
 */
interface DocumentLink {
	/**
	 * The range this link applies to.
	 */
	range: Range;

	/**
	 * The uri this link points to. If missing a resolve request is sent later.
	 */
	target?: URI;

	/**
	 * The tooltip text when you hover over this link.
	 *
	 * If a tooltip is provided, is will be displayed in a string that includes
	 * instructions on how to trigger the link, such as `{0} (ctrl + click)`.
	 * The specific instructions vary depending on OS, user settings, and
	 * localization.
	 *
	 * @since 3.15.0
	 */
	tooltip?: string;

	/**
	 * A data entry field that is preserved on a document link between a
	 * DocumentLinkRequest and a DocumentLinkResolveRequest.
	 */
	data?: LSPAny;
}
  • partial result: DocumentLink[]
  • error: codemessage,以防在请求期间发生异常。

文档链接解析请求从客户端发送到服务器,以解析给定文档链接的目标。

请求(Request):

  • method: "documentLink/resolve"
  • params: DocumentLink

响应(Response):

  • result: DocumentLink
  • error: codemessage,以防在请求期间发生异常。