Fix edit prediction disablement with "disable_ai": true
setting (#35513)
Even after #35327 edit predictions were still being queried and shown after setting `"disable_ai": true` Also moves `DisableAiSettings` to the `project` crate so that it gets included in tests via existing use of `Project::init_settings(cx)`. Release Notes: - Fixed `"disable_ai": true` setting disabling edit predictions.
This commit is contained in:
parent
d577ef52cb
commit
899bc8a8fd
17 changed files with 60 additions and 54 deletions
|
@ -83,7 +83,7 @@ use aho_corasick::AhoCorasick;
|
|||
use anyhow::{Context as _, Result, anyhow};
|
||||
use blink_manager::BlinkManager;
|
||||
use buffer_diff::DiffHunkStatus;
|
||||
use client::{Collaborator, DisableAiSettings, ParticipantIndex};
|
||||
use client::{Collaborator, ParticipantIndex};
|
||||
use clock::{AGENT_REPLICA_ID, ReplicaId};
|
||||
use code_context_menus::{
|
||||
AvailableCodeAction, CodeActionContents, CodeActionsItem, CodeActionsMenu, CodeContextMenu,
|
||||
|
@ -148,8 +148,8 @@ use parking_lot::Mutex;
|
|||
use persistence::DB;
|
||||
use project::{
|
||||
BreakpointWithPosition, CodeAction, Completion, CompletionIntent, CompletionResponse,
|
||||
CompletionSource, DocumentHighlight, InlayHint, Location, LocationLink, PrepareRenameResponse,
|
||||
Project, ProjectItem, ProjectPath, ProjectTransaction, TaskSourceKind,
|
||||
CompletionSource, DisableAiSettings, DocumentHighlight, InlayHint, Location, LocationLink,
|
||||
PrepareRenameResponse, Project, ProjectItem, ProjectPath, ProjectTransaction, TaskSourceKind,
|
||||
debugger::breakpoint_store::Breakpoint,
|
||||
debugger::{
|
||||
breakpoint_store::{
|
||||
|
@ -6995,6 +6995,10 @@ impl Editor {
|
|||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Option<()> {
|
||||
if DisableAiSettings::get_global(cx).disable_ai {
|
||||
return None;
|
||||
}
|
||||
|
||||
let provider = self.edit_prediction_provider()?;
|
||||
let cursor = self.selections.newest_anchor().head();
|
||||
let (buffer, cursor_buffer_position) =
|
||||
|
@ -7052,6 +7056,7 @@ impl Editor {
|
|||
pub fn update_edit_prediction_settings(&mut self, cx: &mut Context<Self>) {
|
||||
if self.edit_prediction_provider.is_none() || DisableAiSettings::get_global(cx).disable_ai {
|
||||
self.edit_prediction_settings = EditPredictionSettings::Disabled;
|
||||
self.discard_inline_completion(false, cx);
|
||||
} else {
|
||||
let selection = self.selections.newest_anchor();
|
||||
let cursor = selection.head();
|
||||
|
@ -7669,6 +7674,10 @@ impl Editor {
|
|||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Option<()> {
|
||||
if DisableAiSettings::get_global(cx).disable_ai {
|
||||
return None;
|
||||
}
|
||||
|
||||
let selection = self.selections.newest_anchor();
|
||||
let cursor = selection.head();
|
||||
let multibuffer = self.buffer.read(cx).snapshot(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue