Add workspace::ToggleEditPrediction
for toggling inline completions globally (#35418)
Closes: https://github.com/zed-industries/zed/issues/23704 Existing action is `editor::ToggleEditPrediction` ("This Buffer"). This action is `workspace::ToggleEditPredction` ("All Files"). You can add a custom keybind wi shortcut with: ```json { "context": "Workspace", "bindings": { "ctrl-alt-cmd-e": "workspace::ToggleEditPrediction" } }, ``` <img width="212" height="439" alt="Screenshot 2025-07-31 at 12 52 19" src="https://github.com/user-attachments/assets/15879daa-7d4d-4308-ab2b-5e78507f2fa5" /> Release Notes: - Added `workspace::ToggleEditPrediction` action for toggling `show_edit_predictions` in settings (Edit Predictions menu -> All Files).
This commit is contained in:
parent
497252480c
commit
5b40b3618f
2 changed files with 35 additions and 20 deletions
|
@ -48,7 +48,10 @@ pub use item::{
|
|||
ProjectItem, SerializableItem, SerializableItemHandle, WeakItemHandle,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{Buffer, LanguageRegistry, Rope};
|
||||
use language::{
|
||||
Buffer, LanguageRegistry, Rope,
|
||||
language_settings::{AllLanguageSettings, all_language_settings},
|
||||
};
|
||||
pub use modal_layer::*;
|
||||
use node_runtime::NodeRuntime;
|
||||
use notifications::{
|
||||
|
@ -74,7 +77,7 @@ use remote::{SshClientDelegate, SshConnectionOptions, ssh_session::ConnectionIde
|
|||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use session::AppSession;
|
||||
use settings::Settings;
|
||||
use settings::{Settings, update_settings_file};
|
||||
use shared_screen::SharedScreen;
|
||||
use sqlez::{
|
||||
bindable::{Bind, Column, StaticColumnCount},
|
||||
|
@ -233,6 +236,8 @@ actions!(
|
|||
ToggleBottomDock,
|
||||
/// Toggles centered layout mode.
|
||||
ToggleCenteredLayout,
|
||||
/// Toggles edit prediction feature globally for all files.
|
||||
ToggleEditPrediction,
|
||||
/// Toggles the left dock.
|
||||
ToggleLeftDock,
|
||||
/// Toggles the right dock.
|
||||
|
@ -5546,6 +5551,7 @@ impl Workspace {
|
|||
.on_action(cx.listener(Self::activate_pane_at_index))
|
||||
.on_action(cx.listener(Self::move_item_to_pane_at_index))
|
||||
.on_action(cx.listener(Self::move_focused_panel_to_next_position))
|
||||
.on_action(cx.listener(Self::toggle_edit_predictions_all_files))
|
||||
.on_action(cx.listener(|workspace, _: &Unfollow, window, cx| {
|
||||
let pane = workspace.active_pane().clone();
|
||||
workspace.unfollow_in_pane(&pane, window, cx);
|
||||
|
@ -5977,6 +5983,19 @@ impl Workspace {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn toggle_edit_predictions_all_files(
|
||||
&mut self,
|
||||
_: &ToggleEditPrediction,
|
||||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let fs = self.project().read(cx).fs().clone();
|
||||
let show_edit_predictions = all_language_settings(None, cx).show_edit_predictions(None, cx);
|
||||
update_settings_file::<AllLanguageSettings>(fs, cx, move |file, _| {
|
||||
file.defaults.show_edit_predictions = Some(!show_edit_predictions)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn leader_border_for_pane(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue