From 48dba9a9d9c94c5af0008150eae93c256d7ccad9 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Thu, 30 Jan 2025 15:03:01 +0100 Subject: [PATCH] edit prediction: Do not request a completion if edits can be interpolated (#23908) This ensures that we do not fetch a new completion when the edits of the user can be interpolated. E.g. (suggestions in `[]`): ```rust s[truct Person {}] ``` Then if i type out `truct` we will not fetch a new completion Release Notes: - N/A --- crates/zeta/src/zeta.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index 074be523bb..99fae6600f 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -1349,6 +1349,17 @@ impl inline_completion::InlineCompletionProvider for ZetaInlineCompletionProvide return; } + if let Some(current_completion) = self.current_completion.as_ref() { + let snapshot = buffer.read(cx).snapshot(); + if current_completion + .completion + .interpolate(&snapshot) + .is_some() + { + return; + } + } + let pending_completion_id = self.next_pending_completion_id; self.next_pending_completion_id += 1;