Reorganize edit prediction code and remove old experiments (#44187)

Release Notes:

- N/A

---------

Co-authored-by: Agus Zubiaga <agus@zed.dev>
Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
Max Brunsfeld
2025-12-04 15:56:57 -08:00
committed by GitHub
co-authored by Agus Zubiaga Ben Kunkle
parent 76167109db
commit 42583c1141
113 changed files with 5598 additions and 15080 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
pub mod copilot_chat;
mod copilot_completion_provider;
mod copilot_edit_prediction_delegate;
pub mod copilot_responses;
pub mod request;
mod sign_in;
@@ -46,7 +46,7 @@ use util::rel_path::RelPath;
use util::{ResultExt, fs::remove_matching};
use workspace::Workspace;
pub use crate::copilot_completion_provider::CopilotCompletionProvider;
pub use crate::copilot_edit_prediction_delegate::CopilotEditPredictionDelegate;
pub use crate::sign_in::{CopilotCodeVerification, initiate_sign_in, reinstall_and_sign_in};
actions!(
@@ -1,6 +1,6 @@
use crate::{Completion, Copilot};
use anyhow::Result;
use edit_prediction::{Direction, EditPrediction, EditPredictionProvider};
use edit_prediction_types::{Direction, EditPrediction, EditPredictionDelegate};
use gpui::{App, Context, Entity, EntityId, Task};
use language::{Buffer, OffsetRangeExt, ToOffset, language_settings::AllLanguageSettings};
use settings::Settings;
@@ -8,7 +8,7 @@ use std::{path::Path, time::Duration};
pub const COPILOT_DEBOUNCE_TIMEOUT: Duration = Duration::from_millis(75);
pub struct CopilotCompletionProvider {
pub struct CopilotEditPredictionDelegate {
cycled: bool,
buffer_id: Option<EntityId>,
completions: Vec<Completion>,
@@ -19,7 +19,7 @@ pub struct CopilotCompletionProvider {
copilot: Entity<Copilot>,
}
impl CopilotCompletionProvider {
impl CopilotEditPredictionDelegate {
pub fn new(copilot: Entity<Copilot>) -> Self {
Self {
cycled: false,
@@ -47,7 +47,7 @@ impl CopilotCompletionProvider {
}
}
impl EditPredictionProvider for CopilotCompletionProvider {
impl EditPredictionDelegate for CopilotEditPredictionDelegate {
fn name() -> &'static str {
"copilot"
}
@@ -56,7 +56,7 @@ impl EditPredictionProvider for CopilotCompletionProvider {
"Copilot"
}
fn show_completions_in_menu() -> bool {
fn show_predictions_in_menu() -> bool {
true
}
@@ -314,7 +314,7 @@ mod tests {
cx,
)
.await;
let copilot_provider = cx.new(|_| CopilotCompletionProvider::new(copilot));
let copilot_provider = cx.new(|_| CopilotEditPredictionDelegate::new(copilot));
cx.update_editor(|editor, window, cx| {
editor.set_edit_prediction_provider(Some(copilot_provider), window, cx)
});
@@ -546,7 +546,7 @@ mod tests {
cx,
)
.await;
let copilot_provider = cx.new(|_| CopilotCompletionProvider::new(copilot));
let copilot_provider = cx.new(|_| CopilotEditPredictionDelegate::new(copilot));
cx.update_editor(|editor, window, cx| {
editor.set_edit_prediction_provider(Some(copilot_provider), window, cx)
});
@@ -670,7 +670,7 @@ mod tests {
cx,
)
.await;
let copilot_provider = cx.new(|_| CopilotCompletionProvider::new(copilot));
let copilot_provider = cx.new(|_| CopilotEditPredictionDelegate::new(copilot));
cx.update_editor(|editor, window, cx| {
editor.set_edit_prediction_provider(Some(copilot_provider), window, cx)
});
@@ -753,7 +753,7 @@ mod tests {
window.focus(&editor.focus_handle(cx));
})
.unwrap();
let copilot_provider = cx.new(|_| CopilotCompletionProvider::new(copilot));
let copilot_provider = cx.new(|_| CopilotEditPredictionDelegate::new(copilot));
editor
.update(cx, |editor, window, cx| {
editor.set_edit_prediction_provider(Some(copilot_provider), window, cx)
@@ -848,7 +848,7 @@ mod tests {
cx,
)
.await;
let copilot_provider = cx.new(|_| CopilotCompletionProvider::new(copilot));
let copilot_provider = cx.new(|_| CopilotEditPredictionDelegate::new(copilot));
cx.update_editor(|editor, window, cx| {
editor.set_edit_prediction_provider(Some(copilot_provider), window, cx)
});
@@ -1000,7 +1000,7 @@ mod tests {
window.focus(&editor.focus_handle(cx))
})
.unwrap();
let copilot_provider = cx.new(|_| CopilotCompletionProvider::new(copilot));
let copilot_provider = cx.new(|_| CopilotEditPredictionDelegate::new(copilot));
editor
.update(cx, |editor, window, cx| {
editor.set_edit_prediction_provider(Some(copilot_provider), window, cx)