diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 690afa91a65ec..d700ae0017dd3 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -604,7 +604,9 @@ pub fn signature_help(cx: &mut Context) { }; contents.set_signature_doc(doc_text.clone()); } - let popup = Popup::new("signature-help", contents); + let mut popup = Popup::new("signature-help", contents); + let old_popup = compositor.find_id::>("signature-help"); + popup.set_position(old_popup.and_then(|p| p.position().copied())); compositor.replace_or_push("signature-help", popup); }, ); diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index 455274822442e..b049f568956d1 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -43,6 +43,10 @@ impl Popup { self.position = pos; } + pub fn position(&self) -> Option<&Position> { + self.position.as_ref() + } + pub fn margin(mut self, margin: Margin) -> Self { self.margin = margin; self