1use crate::{
2 PartialResultParams, Range, TextDocumentIdentifier, WorkDoneProgressOptions,
3 WorkDoneProgressParams,
4};
5use serde::{Deserialize, Serialize};
6use serde_json::Value;
7use url::Url;
8
9#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
10#[serde(rename_all = "camelCase")]
11pub struct DocumentLinkClientCapabilities {
12 /// Whether document link supports dynamic registration.
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub dynamic_registration: Option<bool>,
15
16 /// Whether the client support the `tooltip` property on `DocumentLink`.
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub tooltip_support: Option<bool>,
19}
20
21#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
22#[serde(rename_all = "camelCase")]
23pub struct DocumentLinkOptions {
24 /// Document links have a resolve provider as well.
25 #[serde(skip_serializing_if = "Option::is_none")]
26 pub resolve_provider: Option<bool>,
27
28 #[serde(flatten)]
29 pub work_done_progress_options: WorkDoneProgressOptions,
30}
31
32#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
33#[serde(rename_all = "camelCase")]
34pub struct DocumentLinkParams {
35 /// The document to provide document links for.
36 pub text_document: TextDocumentIdentifier,
37
38 #[serde(flatten)]
39 pub work_done_progress_params: WorkDoneProgressParams,
40
41 #[serde(flatten)]
42 pub partial_result_params: PartialResultParams,
43}
44
45/// A document link is a range in a text document that links to an internal or external resource, like another
46/// text document or a web site.
47#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
48pub struct DocumentLink {
49 /// The range this link applies to.
50 pub range: Range,
51 /// The uri this link points to.
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub target: Option<Url>,
54
55 /// The tooltip text when you hover over this link.
56 ///
57 /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to
58 /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
59 /// user settings, and localization.
60 #[serde(skip_serializing_if = "Option::is_none")]
61 pub tooltip: Option<String>,
62
63 /// A data entry field that is preserved on a document link between a DocumentLinkRequest
64 /// and a DocumentLinkResolveRequest.
65 #[serde(skip_serializing_if = "Option::is_none")]
66 pub data: Option<Value>,
67}
68