Skip to content

Commit

Permalink
Clear completion in completion() call before filling it with data
Browse files Browse the repository at this point in the history
Because triggering completion at the same cursor position adds the same data again
  • Loading branch information
Philipp-M committed Jun 21, 2022
1 parent 1174075 commit 8d3f30c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3622,6 +3622,18 @@ fn remove_primary_selection(cx: &mut Context) {
}

pub fn completion(cx: &mut Context) {
// TODO completion starts to get ugly...
// maybe think about something like completion provider and separate completion-state into helix-view?
let clear_completion = async move {
let call: job::Callback =
Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
let ui = compositor.find::<ui::EditorView>().unwrap();
ui.clear_completion(editor);
});
Ok(call)
};
cx.jobs.callback(clear_completion);

use helix_lsp::{lsp, util::pos_to_lsp_pos};

let (view, doc) = current!(cx.editor);
Expand Down

0 comments on commit 8d3f30c

Please sign in to comment.