From e970d84184c35863cfb685e43bb5e8b30069ca4a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 4 Apr 2023 16:02:25 +0200 Subject: [PATCH] Debounce copilot completions Co-Authored-By: Nathan Sobo --- crates/editor/src/editor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index d12b892e36..7a03c44af5 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -2790,6 +2790,7 @@ impl Editor { let (buffer, buffer_position) = self.buffer.read(cx).text_anchor_for_position(cursor, cx)?; self.copilot_state.pending_refresh = cx.spawn_weak(|this, mut cx| async move { + cx.background().timer(Duration::from_millis(75)).await; let (completion, completions_cycling) = copilot.update(&mut cx, |copilot, cx| { ( copilot.completions(&buffer, buffer_position, cx),