Forbid signature popovers when completion menu is open (#17009)

Closes https://github.com/zed-industries/zed/issues/16748

Release Notes:

- Fixed signature info popovers appearing when completion menu is open
This commit is contained in:
Kirill Bulatov 2024-08-28 18:25:07 +03:00 committed by GitHub
parent 98d74f9317
commit c5f43ee81c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 1 deletions

View File

@ -7507,6 +7507,7 @@ async fn test_completion(cx: &mut gpui::TestAppContext) {
resolve_provider: Some(true),
..Default::default()
}),
signature_help_provider: Some(lsp::SignatureHelpOptions::default()),
..Default::default()
},
cx,
@ -7535,6 +7536,37 @@ async fn test_completion(cx: &mut gpui::TestAppContext) {
.await;
assert_eq!(counter.load(atomic::Ordering::Acquire), 1);
let _handler = handle_signature_help_request(
&mut cx,
lsp::SignatureHelp {
signatures: vec![lsp::SignatureInformation {
label: "test signature".to_string(),
documentation: None,
parameters: Some(vec![lsp::ParameterInformation {
label: lsp::ParameterLabel::Simple("foo: u8".to_string()),
documentation: None,
}]),
active_parameter: None,
}],
active_signature: None,
active_parameter: None,
},
);
cx.update_editor(|editor, cx| {
assert!(
!editor.signature_help_state.is_shown(),
"No signature help was called for"
);
editor.show_signature_help(&ShowSignatureHelp, cx);
});
cx.run_until_parked();
cx.update_editor(|editor, _| {
assert!(
!editor.signature_help_state.is_shown(),
"No signature help should be shown when completions menu is open"
);
});
let apply_additional_edits = cx.update_editor(|editor, cx| {
editor.context_menu_next(&Default::default(), cx);
editor

View File

@ -149,7 +149,7 @@ impl Editor {
}
pub fn show_signature_help(&mut self, _: &ShowSignatureHelp, cx: &mut ViewContext<Self>) {
if self.pending_rename.is_some() {
if self.pending_rename.is_some() || self.has_active_completions_menu() {
return;
}