Skip to content

Commit

Permalink
edit prediction: Do not request a completion if edits can be interpol…
Browse files Browse the repository at this point in the history
…ated (zed-industries#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
  • Loading branch information
bennetbo authored Jan 30, 2025
1 parent 51f07e3 commit 48dba9a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/zeta/src/zeta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 48dba9a

Please sign in to comment.