Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

rust-analyzer: Fix for deserialization error of CargoRunnableArgs (#29291)

Peter Tripp2d43818c047b
diff --git a/crates/project/src/lsp_store/lsp_ext_command.rs b/crates/project/src/lsp_store/lsp_ext_command.rs
index a09cf8e2aff..91075cd2335 100644
--- a/crates/project/src/lsp_store/lsp_ext_command.rs
+++ b/crates/project/src/lsp_store/lsp_ext_command.rs
@@ -393,6 +393,7 @@ impl lsp::request::Request for Runnables {
#[serde(rename_all = "camelCase")]
pub struct RunnablesParams {
pub text_document: lsp::TextDocumentIdentifier,
+ #[serde(default)]
pub position: Option<lsp::Position>,
}
@@ -400,7 +401,7 @@ pub struct RunnablesParams {
#[serde(rename_all = "camelCase")]
pub struct Runnable {
pub label: String,
- #[serde(skip_serializing_if = "Option::is_none")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<lsp::LocationLink>,
pub kind: RunnableKind,
pub args: RunnableArgs,
@@ -424,26 +425,30 @@ pub enum RunnableKind {
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CargoRunnableArgs {
- #[serde(skip_serializing_if = "HashMap::is_empty")]
+ #[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub environment: HashMap<String, String>,
pub cwd: PathBuf,
/// Command to be executed instead of cargo
+ #[serde(default)]
pub override_cargo: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
+ #[serde(default, skip_serializing_if = "Option::is_none")]
pub workspace_root: Option<PathBuf>,
// command, --package and --lib stuff
+ #[serde(default)]
pub cargo_args: Vec<String>,
// stuff after --
+ #[serde(default)]
pub executable_args: Vec<String>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ShellRunnableArgs {
- #[serde(skip_serializing_if = "HashMap::is_empty")]
+ #[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub environment: HashMap<String, String>,
pub cwd: PathBuf,
pub program: String,
+ #[serde(default)]
pub args: Vec<String>,
}