Supermaven (#10788)
Adds a supermaven provider for completions. There are various other refactors amidst this branch, primarily to make copilot no longer a dependency of project as well as show LSP Logs for global LSPs like copilot properly. This feature is not enabled by default. We're going to seek to refine it in the coming weeks. Release Notes: - N/A --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Max <max@zed.dev> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
610968815c
commit
6563330239
47 changed files with 2242 additions and 827 deletions
|
@ -1757,19 +1757,22 @@ impl Editor {
|
|||
self.completion_provider = Some(hub);
|
||||
}
|
||||
|
||||
pub fn set_inline_completion_provider(
|
||||
pub fn set_inline_completion_provider<T>(
|
||||
&mut self,
|
||||
provider: Model<impl InlineCompletionProvider>,
|
||||
provider: Option<Model<T>>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
self.inline_completion_provider = Some(RegisteredInlineCompletionProvider {
|
||||
_subscription: cx.observe(&provider, |this, _, cx| {
|
||||
if this.focus_handle.is_focused(cx) {
|
||||
this.update_visible_inline_completion(cx);
|
||||
}
|
||||
}),
|
||||
provider: Arc::new(provider),
|
||||
});
|
||||
) where
|
||||
T: InlineCompletionProvider,
|
||||
{
|
||||
self.inline_completion_provider =
|
||||
provider.map(|provider| RegisteredInlineCompletionProvider {
|
||||
_subscription: cx.observe(&provider, |this, _, cx| {
|
||||
if this.focus_handle.is_focused(cx) {
|
||||
this.update_visible_inline_completion(cx);
|
||||
}
|
||||
}),
|
||||
provider: Arc::new(provider),
|
||||
});
|
||||
self.refresh_inline_completion(false, cx);
|
||||
}
|
||||
|
||||
|
@ -2676,7 +2679,7 @@ impl Editor {
|
|||
}
|
||||
|
||||
drop(snapshot);
|
||||
let had_active_copilot_completion = this.has_active_inline_completion(cx);
|
||||
let had_active_inline_completion = this.has_active_inline_completion(cx);
|
||||
this.change_selections(Some(Autoscroll::fit()), cx, |s| s.select(new_selections));
|
||||
|
||||
if brace_inserted {
|
||||
|
@ -2692,7 +2695,7 @@ impl Editor {
|
|||
}
|
||||
}
|
||||
|
||||
if had_active_copilot_completion {
|
||||
if had_active_inline_completion {
|
||||
this.refresh_inline_completion(true, cx);
|
||||
if !this.has_active_inline_completion(cx) {
|
||||
this.trigger_completion_on_input(&text, cx);
|
||||
|
@ -4005,7 +4008,7 @@ impl Editor {
|
|||
if !self.show_inline_completions
|
||||
|| !provider.is_enabled(&buffer, cursor_buffer_position, cx)
|
||||
{
|
||||
self.clear_inline_completion(cx);
|
||||
self.discard_inline_completion(cx);
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@ -4207,13 +4210,6 @@ impl Editor {
|
|||
self.discard_inline_completion(cx);
|
||||
}
|
||||
|
||||
fn clear_inline_completion(&mut self, cx: &mut ViewContext<Self>) {
|
||||
if let Some(old_completion) = self.active_inline_completion.take() {
|
||||
self.splice_inlays(vec![old_completion.id], Vec::new(), cx);
|
||||
}
|
||||
self.discard_inline_completion(cx);
|
||||
}
|
||||
|
||||
fn inline_completion_provider(&self) -> Option<Arc<dyn InlineCompletionProviderHandle>> {
|
||||
Some(self.inline_completion_provider.as_ref()?.provider.clone())
|
||||
}
|
||||
|
@ -9947,12 +9943,14 @@ impl Editor {
|
|||
.raw_user_settings()
|
||||
.get("vim_mode")
|
||||
== Some(&serde_json::Value::Bool(true));
|
||||
let copilot_enabled = all_language_settings(file, cx).copilot_enabled(None, None);
|
||||
|
||||
let copilot_enabled = all_language_settings(file, cx).inline_completions.provider
|
||||
== language::language_settings::InlineCompletionProvider::Copilot;
|
||||
let copilot_enabled_for_language = self
|
||||
.buffer
|
||||
.read(cx)
|
||||
.settings_at(0, cx)
|
||||
.show_copilot_suggestions;
|
||||
.show_inline_completions;
|
||||
|
||||
let telemetry = project.read(cx).client().telemetry().clone();
|
||||
telemetry.report_editor_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue