on master help sign in
If completion arrives after we already stopped editing, ignore it
commit2a92dd8d4d3acbdc55e98217260346622c95250e authorBlaž Hrastnik <blaz@mxxn.io> dateWed 30 Jun 2021, 17:42 (5 years ago) parentacaf22d
1 file changed+6
helix-term/src/commands.rs+6
helix-term/src/commands.rs+6
@@ -3161,6 +3161,12 @@ fn completion(cx: &mut Context) {
31613161 move |editor: &mut Editor,
31623162 compositor: &mut Compositor,
31633163 response: Option<lsp::CompletionResponse>| {
3164+ let (_, doc) = current!(editor);
3165+ if doc.mode() != Mode::Insert {
3166+ // we're not in insert mode anymore
3167+ return;
3168+ }
3169+
31643170 let items = match response {
31653171 Some(lsp::CompletionResponse::Array(items)) => items,
31663172 // TODO: do something with is_incomplete