diff --git a/crates/collab_ui/src/chat_panel/message_editor.rs b/crates/collab_ui/src/chat_panel/message_editor.rs index c19d19085c..48d3f31aa9 100644 --- a/crates/collab_ui/src/chat_panel/message_editor.rs +++ b/crates/collab_ui/src/chat_panel/message_editor.rs @@ -61,6 +61,16 @@ impl CompletionProvider for MessageEditorCompletionProvider { ) -> Task> { Task::ready(Ok(false)) } + + fn apply_additional_edits_for_completion( + &self, + _buffer: Model, + _completion: Completion, + _push_to_history: bool, + _cx: &mut ViewContext, + ) -> Task>> { + Task::ready(Ok(None)) + } } impl MessageEditor { diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 55090d75d9..47e4acdedf 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -3285,15 +3285,13 @@ impl Editor { this.refresh_copilot_suggestions(true, cx); }); - let project = self.project.clone()?; - let apply_edits = project.update(cx, |project, cx| { - project.apply_additional_edits_for_completion( - buffer_handle, - completion.clone(), - true, - cx, - ) - }); + let provider = self.completion_provider.as_ref()?; + let apply_edits = provider.apply_additional_edits_for_completion( + buffer_handle, + completion.clone(), + true, + cx, + ); Some(cx.foreground_executor().spawn(async move { apply_edits.await?; Ok(()) @@ -8912,12 +8910,21 @@ pub trait CompletionProvider { buffer_position: text::Anchor, cx: &mut ViewContext, ) -> Task>>; + fn resolve_completions( &self, completion_indices: Vec, completions: Arc>>, cx: &mut ViewContext, ) -> Task>; + + fn apply_additional_edits_for_completion( + &self, + buffer: Model, + completion: Completion, + push_to_history: bool, + cx: &mut ViewContext, + ) -> Task>>; } impl CompletionProvider for Model { @@ -8942,6 +8949,18 @@ impl CompletionProvider for Model { project.resolve_completions(completion_indices, completions, cx) }) } + + fn apply_additional_edits_for_completion( + &self, + buffer: Model, + completion: Completion, + push_to_history: bool, + cx: &mut ViewContext, + ) -> Task>> { + self.update(cx, |project, cx| { + project.apply_additional_edits_for_completion(buffer, completion, push_to_history, cx) + }) + } } fn inlay_hint_settings(