Fix non-lsp compliant Response definition

This commit is contained in:
Lukas Wirth 2025-08-06 17:46:39 +02:00
parent 8d75311400
commit fc9a89dd19
4 changed files with 29 additions and 29 deletions

8
Cargo.lock generated
View file

@ -1294,7 +1294,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "lsp-server"
version = "0.7.8"
version = "0.7.9"
dependencies = [
"anyhow",
"crossbeam-channel",
@ -1310,9 +1310,9 @@ dependencies = [
[[package]]
name = "lsp-server"
version = "0.7.8"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9462c4dc73e17f971ec1f171d44bfffb72e65a130117233388a0ebc7ec5656f9"
checksum = "7d6ada348dbc2703cbe7637b2dda05cff84d3da2819c24abcb305dd613e0ba2e"
dependencies = [
"crossbeam-channel",
"log",
@ -2007,7 +2007,7 @@ dependencies = [
"intern",
"itertools 0.14.0",
"load-cargo",
"lsp-server 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-server 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-types",
"memchr",
"mimalloc",

View file

@ -100,7 +100,7 @@ ra-ap-rustc_pattern_analysis = { version = "0.123", default-features = false }
# in-tree crates that are published separately and follow semver. See lib/README.md
line-index = { version = "0.1.2" }
la-arena = { version = "0.3.1" }
lsp-server = { version = "0.7.8" }
lsp-server = { version = "0.7.9" }
# non-local crates
anyhow = "1.0.98"
@ -125,11 +125,11 @@ memmap2 = "0.9.5"
nohash-hasher = "0.2.0"
oorandom = "11.1.5"
object = { version = "0.36.7", default-features = false, features = [
"std",
"read_core",
"elf",
"macho",
"pe",
"std",
"read_core",
"elf",
"macho",
"pe",
] }
process-wrap = { version = "8.2.1", features = ["std"] }
pulldown-cmark-to-cmark = "10.0.4"
@ -139,9 +139,9 @@ rowan = "=0.15.15"
# Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
# on impls without it
salsa = { version = "0.23.0", default-features = true, features = [
"rayon",
"salsa_unstable",
"macros",
"rayon",
"salsa_unstable",
"macros",
] }
salsa-macros = "0.23.0"
semver = "1.0.26"
@ -151,9 +151,9 @@ serde_json = "1.0.140"
rustc-hash = "2.1.1"
rustc-literal-escaper = "0.0.4"
smallvec = { version = "1.15.1", features = [
"const_new",
"union",
"const_generics",
"const_new",
"union",
"const_generics",
] }
smol_str = "0.3.2"
temp-dir = "0.1.16"
@ -161,12 +161,12 @@ text-size = "1.1.1"
tracing = "0.1.41"
tracing-tree = "0.4.0"
tracing-subscriber = { version = "0.3.19", default-features = false, features = [
"registry",
"fmt",
"local-time",
"std",
"time",
"tracing-log",
"registry",
"fmt",
"local-time",
"std",
"time",
"tracing-log",
] }
triomphe = { version = "0.1.14", default-features = false, features = ["std"] }
url = "2.5.4"
@ -176,7 +176,7 @@ xshell = "0.2.7"
dashmap = { version = "=6.1.0", features = ["raw-api", "inline"] }
# We need to freeze the version of the crate, as it needs to match with dashmap
hashbrown = { version = "0.14.*", features = [
"inline-more",
"inline-more",
], default-features = false }
[workspace.lints.rust]

View file

@ -1,6 +1,6 @@
[package]
name = "lsp-server"
version = "0.7.8"
version = "0.7.9"
description = "Generic LSP server scaffold."
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/lsp-server"
@ -16,9 +16,9 @@ crossbeam-channel.workspace = true
[dev-dependencies]
lsp-types = "=0.95"
ctrlc = "3.4.7"
anyhow.workspace = true
anyhow.workspace = true
rustc-hash.workspace = true
toolchain.workspace = true
toolchain.workspace = true
[lints]
workspace = true

View file

@ -84,9 +84,9 @@ pub struct Response {
// request id. We fail deserialization in that case, so we just
// make this field mandatory.
pub id: RequestId,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none", default)]
pub result: Option<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none", default)]
pub error: Option<ResponseError>,
}
@ -94,7 +94,7 @@ pub struct Response {
pub struct ResponseError {
pub code: i32,
pub message: String,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none", default)]
pub data: Option<serde_json::Value>,
}