about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2025-01-05 16:18:20 +0100
committerLukas Wirth <lukastw97@gmail.com>2025-01-06 11:22:42 +0100
commit0389235a15ab0a210db1f3eed04ddbafe01d9bcc (patch)
tree2ef720e653104c166fe5d04beb56a608d792f58c
parent70ba3b56ff99680273ec6700f591c5284ba370a3 (diff)
downloadrust-0389235a15ab0a210db1f3eed04ddbafe01d9bcc.tar.gz
rust-0389235a15ab0a210db1f3eed04ddbafe01d9bcc.zip
fix: Be more permissive with completion resolve data
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs5
-rw-r--r--src/tools/rust-analyzer/docs/dev/lsp-extensions.md2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs
index e1677cbcda8..f50cbba7acf 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/ext.rs
@@ -1,5 +1,9 @@
 //! rust-analyzer extensions to the LSP.
 
+// Note when adding new resolve payloads, add a #[serde(default)] on boolean fields as some clients
+// might strip `false` values from the JSON payload due to their reserialization logic turning false
+// into null which will then cause them to be omitted in the resolve request. See https://github.com/rust-lang/rust-analyzer/issues/18767
+
 #![allow(clippy::disallowed_types)]
 
 use std::ops;
@@ -829,6 +833,7 @@ pub struct CompletionResolveData {
     pub version: Option<i32>,
     #[serde(skip_serializing_if = "Option::is_none", default)]
     pub trigger_character: Option<char>,
+    #[serde(default)]
     pub for_ref: bool,
     pub hash: String,
 }
diff --git a/src/tools/rust-analyzer/docs/dev/lsp-extensions.md b/src/tools/rust-analyzer/docs/dev/lsp-extensions.md
index 826ce112448..21ac3a5a269 100644
--- a/src/tools/rust-analyzer/docs/dev/lsp-extensions.md
+++ b/src/tools/rust-analyzer/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
 <!---
-lsp/ext.rs hash: 512c06cd8b46a21d
+lsp/ext.rs hash: 6dd762ae19630ec0
 
 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: