Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs20
-rw-r--r--crates/rust-analyzer/src/to_proto.rs4
-rw-r--r--docs/dev/lsp-extensions.md2
3 files changed, 22 insertions, 4 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs
index 846f151304..2e131eeac9 100644
--- a/crates/rust-analyzer/src/lsp_ext.rs
+++ b/crates/rust-analyzer/src/lsp_ext.rs
@@ -255,7 +255,7 @@ impl InlayHintKind {
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InlayHint {
- pub label: String,
+ pub label: InlayHintLabel,
pub position: Position,
pub kind: Option<InlayHintKind>,
pub tooltip: Option<String>,
@@ -263,6 +263,24 @@ pub struct InlayHint {
pub padding_right: Option<bool>,
}
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum InlayHintLabel {
+ String(String),
+ Parts(Vec<InlayHintLabelPart>),
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct InlayHintLabelPart {
+ pub value: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub tooltip: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub location: Option<lsp_types::LocationLink>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub command: Option<lsp_types::Command>,
+}
pub enum Ssr {}
impl Request for Ssr {
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 6db47cdb1f..fd6602624f 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -419,11 +419,11 @@ pub(crate) fn inlay_hint(
inlay_hint: InlayHint,
) -> lsp_ext::InlayHint {
lsp_ext::InlayHint {
- label: match inlay_hint.kind {
+ label: lsp_ext::InlayHintLabel::String(match inlay_hint.kind {
InlayKind::ParameterHint if render_colons => format!("{}:", inlay_hint.label),
InlayKind::TypeHint if render_colons => format!(": {}", inlay_hint.label),
_ => inlay_hint.label.to_string(),
- },
+ }),
position: match inlay_hint.kind {
InlayKind::ParameterHint => position(line_index, inlay_hint.range.start()),
InlayKind::TypeHint | InlayKind::ChainingHint => {
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 9f1c7fe0a3..3091bdcbf0 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
<!---
-lsp_ext.rs hash: e32fdde032ff6ebc
+lsp_ext.rs hash: 854109e98d02a780
If you need to change the above hash to make the test pass, please check if you
need to adjust this doc as well and ping this issue: