aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-30 08:42:23 +0000
committerBlaž Hrastnik2021-06-30 08:49:42 +0000
commit2a92dd8d4d3acbdc55e98217260346622c95250e (patch)
treeccb62bfe54be84b614680875cf94f503026e18ca /helix-term/src
parentacaf22d00548c39c5bc86eea58cf523508a9c3b6 (diff)
If completion arrives after we already stopped editing, ignore it
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs6
1 files changed, 6 insertions, 0 deletions
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<lsp::CompletionResponse>| {
+ 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