From 2a92dd8d4d3acbdc55e98217260346622c95250e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 30 Jun 2021 17:42:23 +0900 Subject: [PATCH] If completion arrives after we already stopped editing, ignore it --- helix-term/src/commands.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c994d8cc..fa251ff0 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3161,6 +3161,12 @@ fn completion(cx: &mut Context) { move |editor: &mut Editor, compositor: &mut Compositor, response: Option| { + let (_, doc) = current!(editor); + if doc.mode() != Mode::Insert { + // we're not in insert mode anymore + return; + } + let items = match response { Some(lsp::CompletionResponse::Array(items)) => items, // TODO: do something with is_incomplete