summaryrefslogtreecommitdiff
path: root/helix-term/src/commands/lsp.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-03-30 16:22:51 +0000
committerBlaž Hrastnik2023-03-31 06:19:28 +0000
commit7a69c40524833f93c3df32ba457a1a658472bb4b (patch)
tree6bfa45e39db0f195abed2e51e4335f8cdc69ecbc /helix-term/src/commands/lsp.rs
parentab819d80f1391667f8ff6b149fa4fbe977f4607a (diff)
Hide signature help if it overlays completion menu (#5523)
Diffstat (limited to 'helix-term/src/commands/lsp.rs')
-rw-r--r--helix-term/src/commands/lsp.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index 0b0d1db4..f8e83a46 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -1221,10 +1221,25 @@ pub fn signature_help_impl(cx: &mut Context, invoked: SignatureHelpInvoked) {
contents.set_active_param_range(active_param_range());
let old_popup = compositor.find_id::<Popup<SignatureHelp>>(SignatureHelp::ID);
- let popup = Popup::new(SignatureHelp::ID, contents)
+ let mut popup = Popup::new(SignatureHelp::ID, contents)
.position(old_popup.and_then(|p| p.get_position()))
.position_bias(Open::Above)
.ignore_escape_key(true);
+
+ // Don't create a popup if it intersects the auto-complete menu.
+ let size = compositor.size();
+ if compositor
+ .find::<ui::EditorView>()
+ .unwrap()
+ .completion
+ .as_mut()
+ .map(|completion| completion.area(size, editor))
+ .filter(|area| area.intersects(popup.area(size, editor)))
+ .is_some()
+ {
+ return;
+ }
+
compositor.replace_or_push(SignatureHelp::ID, popup);
},
);