Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Forbid signature popovers when completion menu is open (#17009)
Kirill Bulatovc5f43ee81ccf
diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rsindex 4d08466bc70..1a22ab7475b 100644--- a/crates/editor/src/editor_tests.rs+++ b/crates/editor/src/editor_tests.rs@@ -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);editordiff --git a/crates/editor/src/signature_help.rs b/crates/editor/src/signature_help.rsindex 9a19e0e0fdf..5b1d9ab1b3d 100644--- a/crates/editor/src/signature_help.rs+++ b/crates/editor/src/signature_help.rs@@ -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;}