project: Make textDocument/signatureHelp implementation lsp compliant (#40707)
The parameter label offsets are utf16 offsets, not utf8. Additionally we now validate the language server output. Closes https://github.com/zed-industries/zed/issues/40578 Companion bug on rust-analyzer side https://github.com/rust-lang/rust-analyzer/pull/20876 Release Notes: - Fixed `textDocument/signatureHelp` implementation not being LSP compliant
This commit is contained in:
@@ -1834,13 +1834,20 @@ impl LspCommand for GetSignatureHelp {
|
||||
message: Option<lsp::SignatureHelp>,
|
||||
lsp_store: Entity<LspStore>,
|
||||
_: Entity<Buffer>,
|
||||
_: LanguageServerId,
|
||||
id: LanguageServerId,
|
||||
cx: AsyncApp,
|
||||
) -> Result<Self::Response> {
|
||||
let Some(message) = message else {
|
||||
return Ok(None);
|
||||
};
|
||||
cx.update(|cx| SignatureHelp::new(message, Some(lsp_store.read(cx).languages.clone()), cx))
|
||||
cx.update(|cx| {
|
||||
SignatureHelp::new(
|
||||
message,
|
||||
Some(lsp_store.read(cx).languages.clone()),
|
||||
Some(id),
|
||||
cx,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn to_proto(&self, project_id: u64, buffer: &Buffer) -> Self::ProtoRequest {
|
||||
@@ -1900,7 +1907,12 @@ impl LspCommand for GetSignatureHelp {
|
||||
.signature_help
|
||||
.map(proto_to_lsp_signature)
|
||||
.and_then(|signature| {
|
||||
SignatureHelp::new(signature, Some(lsp_store.read(cx).languages.clone()), cx)
|
||||
SignatureHelp::new(
|
||||
signature,
|
||||
Some(lsp_store.read(cx).languages.clone()),
|
||||
None,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user