From 3cc91ec4d768bffa4b1d3920d7066aafc48e3e5a Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Mon, 29 Apr 2019 14:55:51 +0200 Subject: Better handling of asynchronous completion. --- ide/wg_Completion.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ide/wg_Completion.ml b/ide/wg_Completion.ml index 21d794ce6e..396939cfcc 100644 --- a/ide/wg_Completion.ml +++ b/ide/wg_Completion.ml @@ -109,9 +109,11 @@ class completion_provider coqtop = let props = self#update_proposals w in self#add_proposals ctx props else + let cancel = ref false in + let _ = ctx#connect#cancelled ~callback:(fun () -> cancel := true) in let update props = let () = cache <- (start_offset, w, props) in - self#add_proposals ctx props; + if not !cancel then self#add_proposals ctx props in (* If not in the cache, we recompute it: first syntactic *) let synt = get_syntactic_completion buffer w Proposals.empty in -- cgit v1.2.3