edit predictions: Reset onboarding action (#24387)
https://github.com/user-attachments/assets/bb597b93-a616-4f8a-8608-013b8202799c Release Notes: - N/A
This commit is contained in:
parent
09967ac3d0
commit
e1bb9570df
3 changed files with 50 additions and 24 deletions
|
@ -4,11 +4,16 @@ use command_palette_hooks::CommandPaletteFilter;
|
|||
use feature_flags::{
|
||||
FeatureFlagAppExt as _, PredictEditsFeatureFlag, PredictEditsRateCompletionsFeatureFlag,
|
||||
};
|
||||
use gpui::actions;
|
||||
use language::language_settings::{AllLanguageSettings, InlineCompletionProvider};
|
||||
use settings::update_settings_file;
|
||||
use ui::App;
|
||||
use workspace::Workspace;
|
||||
|
||||
use crate::{onboarding_modal::ZedPredictModal, RateCompletionModal, RateCompletions};
|
||||
|
||||
actions!(edit_predictions, [ResetOnboarding]);
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
cx.observe_new(move |workspace: &mut Workspace, _, _cx| {
|
||||
workspace.register_action(|workspace, _: &RateCompletions, window, cx| {
|
||||
|
@ -31,6 +36,20 @@ pub fn init(cx: &mut App) {
|
|||
}
|
||||
},
|
||||
);
|
||||
|
||||
workspace.register_action(|workspace, _: &ResetOnboarding, _window, cx| {
|
||||
update_settings_file::<AllLanguageSettings>(
|
||||
workspace.app_state().fs.clone(),
|
||||
cx,
|
||||
move |file, _| {
|
||||
file.features
|
||||
.get_or_insert(Default::default())
|
||||
.inline_completion_provider = Some(InlineCompletionProvider::None)
|
||||
},
|
||||
);
|
||||
|
||||
crate::onboarding_banner::clear_dismissed(cx);
|
||||
});
|
||||
})
|
||||
.detach();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue