@@ -715,6 +715,8 @@ fn kill_to_line_start(cx: &mut Context) {
715 Range::new(head, anchor)
715 Range::new(head, anchor)
717 delete_selection_insert_mode(doc, view, &selection);
717 delete_selection_insert_mode(doc, view, &selection);
719+ lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
720fn kill_to_line_end(cx: &mut Context) {
722fn kill_to_line_end(cx: &mut Context) {
@@ -734,6 +736,8 @@ fn kill_to_line_end(cx: &mut Context) {
734 new_range
736 new_range
736 delete_selection_insert_mode(doc, view, &selection);
738 delete_selection_insert_mode(doc, view, &selection);
740+ lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
739fn goto_first_nonwhitespace(cx: &mut Context) {
743fn goto_first_nonwhitespace(cx: &mut Context) {
@@ -2399,7 +2403,8 @@ async fn make_format_callback(
2399 Ok(call)
2403 Ok(call)
2406+#[derive(PartialEq)]
2402−enum Open {
2407+pub enum Open {
@@ -2797,6 +2802,9 @@ pub mod insert {
2797 use helix_lsp::lsp;
2802 use helix_lsp::lsp;
2798 // if ch matches signature_help char, trigger
2803 // if ch matches signature_help char, trigger
2799 let doc = doc_mut!(cx.editor);
2804 let doc = doc_mut!(cx.editor);
2805+ // The language_server!() macro is not used here since it will
2806+ // print an "LSP not active for current buffer" message on
2800 let language_server = match doc.language_server() {
2808 let language_server = match doc.language_server() {
2801 Some(language_server) => language_server,
2809 Some(language_server) => language_server,
2802 None => return,
2810 None => return,
@@ -2816,26 +2824,15 @@ pub mod insert {
2817 // TODO: what if trigger is multiple chars long
2825 // TODO: what if trigger is multiple chars long
2818 let is_trigger = triggers.iter().any(|trigger| trigger.contains(ch));
2826 let is_trigger = triggers.iter().any(|trigger| trigger.contains(ch));
2827+ // lsp doesn't tell us when to close the signature help, so we request
2828+ // the help information again after common close triggers which should
2829+ // return None, which in turn closes the popup.
2830+ let close_triggers = &[')', ';', '.'];
2820− if is_trigger {
2832+ if is_trigger || close_triggers.contains(&ch) {
2821− super::signature_help(cx);
2833+ super::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
2827− // SignatureInformation {
2828− // label: "fn open(&mut self, path: PathBuf, action: Action) -> Result<DocumentId, Error>",
2829− // documentation: None,
2830− // parameters: Some(
2831− // [ParameterInformation { label: Simple("path: PathBuf"), documentation: None },
2832− // ParameterInformation { label: Simple("action: Action"), documentation: None }]
2834− // active_parameter: Some(0)
2837− // active_signature: None, active_parameter: Some(0)
2841 // The default insert hook: simply insert the character
2838 // The default insert hook: simply insert the character
@@ -2870,7 +2867,6 @@ pub mod insert {
2870 // this could also generically look at Transaction, but it's a bit annoying to look at
2867 // this could also generically look at Transaction, but it's a bit annoying to look at
2871 // Operation instead of Change.
2868 // Operation instead of Change.
2872 for hook in &[language_server_completion, signature_help] {
2869 for hook in &[language_server_completion, signature_help] {
2873− // for hook in &[signature_help] {
2874 hook(cx, c);
2870 hook(cx, c);
@@ -3042,6 +3038,8 @@ pub mod insert {
3044 doc.apply(&transaction, view.id);
3040 doc.apply(&transaction, view.id);
3042+ lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
3047 pub fn delete_char_forward(cx: &mut Context) {
3045 pub fn delete_char_forward(cx: &mut Context) {
@@ -3058,6 +3056,8 @@ pub mod insert {
3060 doc.apply(&transaction, view.id);
3058 doc.apply(&transaction, view.id);
3060+ lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
3063 pub fn delete_word_backward(cx: &mut Context) {
3063 pub fn delete_word_backward(cx: &mut Context) {
@@ -3071,6 +3071,8 @@ pub mod insert {
3071 exclude_cursor(text, next, range)
3071 exclude_cursor(text, next, range)
3073 delete_selection_insert_mode(doc, view, &selection);
3073 delete_selection_insert_mode(doc, view, &selection);
3075+ lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
3076 pub fn delete_word_forward(cx: &mut Context) {
3078 pub fn delete_word_forward(cx: &mut Context) {
@@ -3083,6 +3085,8 @@ pub mod insert {
3083 .clone()
3085 .clone()
3084 .transform(|range| movement::move_next_word_start(text, range, count));
3086 .transform(|range| movement::move_next_word_start(text, range, count));
3085 delete_selection_insert_mode(doc, view, &selection);
3087 delete_selection_insert_mode(doc, view, &selection);
3089+ lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);