Skip to content

Commit

Permalink
Do not move signature help popup on multiple triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
sudormrfbin committed Mar 2, 2022
1 parent 6fee8d9 commit ef8b94a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion helix-term/src/commands/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Popup<SignatureHelp>>("signature-help");
popup.set_position(old_popup.and_then(|p| p.position().copied()));
compositor.replace_or_push("signature-help", popup);
},
);
Expand Down
4 changes: 4 additions & 0 deletions helix-term/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ impl<T: Component> Popup<T> {
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
Expand Down

0 comments on commit ef8b94a

Please sign in to comment.