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

@ -2362,6 +2362,10 @@ impl Editor {
None => {}
}
if self.signature_help_state.has_multiple_signatures() {
key_context.add("showing_signature_help");
}
// Disable vim contexts when a sub-editor (e.g. rename/inline assistant) is focused.
if !self.focus_handle(cx).contains_focused(window, cx)
|| (self.is_focused(window) || self.mouse_menu_is_focused(window, cx))
@ -12582,6 +12586,38 @@ impl Editor {
}
}
pub fn signature_help_prev(
&mut self,
_: &SignatureHelpPrevious,
_: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(popover) = self.signature_help_state.popover_mut() {
if popover.current_signature == 0 {
popover.current_signature = popover.signatures.len() - 1;
} else {
popover.current_signature -= 1;
}
cx.notify();
}
}
pub fn signature_help_next(
&mut self,
_: &SignatureHelpNext,
_: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(popover) = self.signature_help_state.popover_mut() {
if popover.current_signature + 1 == popover.signatures.len() {
popover.current_signature = 0;
} else {
popover.current_signature += 1;
}
cx.notify();
}
}
pub fn move_to_previous_word_start(
&mut self,
_: &MoveToPreviousWordStart,