lsp: Complete overloaded signature help implementation (#33199)

This PR revives zed-industries/zed#27818 and aims to complete the
partially implemented overloaded signature help feature.

The first commit is a rebase of zed-industries/zed#27818, and the
subsequent commit addresses all review feedback from the original PR.

Now the overloaded signature help works like


https://github.com/user-attachments/assets/e253c9a0-e3a5-4bfe-8003-eb75de41f672

Closes #21493

Release Notes:

- Implemented signature help for overloaded items. Additionally, added a
support for rendering signature help documentation.

---------

Co-authored-by: Fernando Tagawa <tagawafernando@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
Shuhei Kadowaki 2025-07-03 02:51:08 +09:00 committed by GitHub
parent aa60647fe8
commit 105acacff9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 727 additions and 214 deletions

View file

@ -1846,12 +1846,15 @@ impl LspCommand for GetSignatureHelp {
async fn response_from_lsp(
self,
message: Option<lsp::SignatureHelp>,
_: Entity<LspStore>,
lsp_store: Entity<LspStore>,
_: Entity<Buffer>,
_: LanguageServerId,
_: AsyncApp,
cx: AsyncApp,
) -> Result<Self::Response> {
Ok(message.and_then(SignatureHelp::new))
let Some(message) = message else {
return Ok(None);
};
cx.update(|cx| SignatureHelp::new(message, Some(lsp_store.read(cx).languages.clone()), cx))
}
fn to_proto(&self, project_id: u64, buffer: &Buffer) -> Self::ProtoRequest {
@ -1902,14 +1905,18 @@ impl LspCommand for GetSignatureHelp {
async fn response_from_proto(
self,
response: proto::GetSignatureHelpResponse,
_: Entity<LspStore>,
lsp_store: Entity<LspStore>,
_: Entity<Buffer>,
_: AsyncApp,
cx: AsyncApp,
) -> Result<Self::Response> {
Ok(response
.signature_help
.map(proto_to_lsp_signature)
.and_then(SignatureHelp::new))
cx.update(|cx| {
response
.signature_help
.map(proto_to_lsp_signature)
.and_then(|signature| {
SignatureHelp::new(signature, Some(lsp_store.read(cx).languages.clone()), cx)
})
})
}
fn buffer_id_from_proto(message: &Self::ProtoRequest) -> Result<BufferId> {