Merge pull request #20393 from rust-lang/veykril/push-urpzrkwpkmxw

Fix non-lsp compliant `Response` definition
This commit is contained in:
Lukas Wirth 2025-08-06 16:12:58 +00:00 committed by GitHub
commit 529d3b935d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 29 deletions

8
Cargo.lock generated
View File

@ -1294,7 +1294,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]] [[package]]
name = "lsp-server" name = "lsp-server"
version = "0.7.8" version = "0.7.9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crossbeam-channel", "crossbeam-channel",
@ -1310,9 +1310,9 @@ dependencies = [
[[package]] [[package]]
name = "lsp-server" name = "lsp-server"
version = "0.7.8" version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9462c4dc73e17f971ec1f171d44bfffb72e65a130117233388a0ebc7ec5656f9" checksum = "7d6ada348dbc2703cbe7637b2dda05cff84d3da2819c24abcb305dd613e0ba2e"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"log", "log",
@ -2007,7 +2007,7 @@ dependencies = [
"intern", "intern",
"itertools 0.14.0", "itertools 0.14.0",
"load-cargo", "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", "lsp-types",
"memchr", "memchr",
"mimalloc", "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 # in-tree crates that are published separately and follow semver. See lib/README.md
line-index = { version = "0.1.2" } line-index = { version = "0.1.2" }
la-arena = { version = "0.3.1" } la-arena = { version = "0.3.1" }
lsp-server = { version = "0.7.8" } lsp-server = { version = "0.7.9" }
# non-local crates # non-local crates
anyhow = "1.0.98" anyhow = "1.0.98"
@ -125,11 +125,11 @@ memmap2 = "0.9.5"
nohash-hasher = "0.2.0" nohash-hasher = "0.2.0"
oorandom = "11.1.5" oorandom = "11.1.5"
object = { version = "0.36.7", default-features = false, features = [ object = { version = "0.36.7", default-features = false, features = [
"std", "std",
"read_core", "read_core",
"elf", "elf",
"macho", "macho",
"pe", "pe",
] } ] }
process-wrap = { version = "8.2.1", features = ["std"] } process-wrap = { version = "8.2.1", features = ["std"] }
pulldown-cmark-to-cmark = "10.0.4" 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 # Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
# on impls without it # on impls without it
salsa = { version = "0.23.0", default-features = true, features = [ salsa = { version = "0.23.0", default-features = true, features = [
"rayon", "rayon",
"salsa_unstable", "salsa_unstable",
"macros", "macros",
] } ] }
salsa-macros = "0.23.0" salsa-macros = "0.23.0"
semver = "1.0.26" semver = "1.0.26"
@ -151,9 +151,9 @@ serde_json = "1.0.140"
rustc-hash = "2.1.1" rustc-hash = "2.1.1"
rustc-literal-escaper = "0.0.4" rustc-literal-escaper = "0.0.4"
smallvec = { version = "1.15.1", features = [ smallvec = { version = "1.15.1", features = [
"const_new", "const_new",
"union", "union",
"const_generics", "const_generics",
] } ] }
smol_str = "0.3.2" smol_str = "0.3.2"
temp-dir = "0.1.16" temp-dir = "0.1.16"
@ -161,12 +161,12 @@ text-size = "1.1.1"
tracing = "0.1.41" tracing = "0.1.41"
tracing-tree = "0.4.0" tracing-tree = "0.4.0"
tracing-subscriber = { version = "0.3.19", default-features = false, features = [ tracing-subscriber = { version = "0.3.19", default-features = false, features = [
"registry", "registry",
"fmt", "fmt",
"local-time", "local-time",
"std", "std",
"time", "time",
"tracing-log", "tracing-log",
] } ] }
triomphe = { version = "0.1.14", default-features = false, features = ["std"] } triomphe = { version = "0.1.14", default-features = false, features = ["std"] }
url = "2.5.4" url = "2.5.4"
@ -176,7 +176,7 @@ xshell = "0.2.7"
dashmap = { version = "=6.1.0", features = ["raw-api", "inline"] } 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 # We need to freeze the version of the crate, as it needs to match with dashmap
hashbrown = { version = "0.14.*", features = [ hashbrown = { version = "0.14.*", features = [
"inline-more", "inline-more",
], default-features = false } ], default-features = false }
[workspace.lints.rust] [workspace.lints.rust]

View File

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

View File

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