Allow running certain Zed actions when headless (#32095)
Rework of https://github.com/zed-industries/zed/pull/30783 Before: <img width="483" alt="before_1" src="https://github.com/user-attachments/assets/c08531ce-0c1c-4a91-8375-4542220fc1b1" /> <img width="250" alt="before_2" src="https://github.com/user-attachments/assets/e6f5404e-4e00-4125-bf2b-59a5bc6c41c1" /> <img width="369" alt="before_3" src="https://github.com/user-attachments/assets/6a17c63d-80f6-4d91-a63b-69a9d8fe533a" /> After: <img width="443" alt="after_1" src="https://github.com/user-attachments/assets/4f7203c2-0065-41da-b7df-02aeba89ab7b" /> <img width="246" alt="after_2" src="https://github.com/user-attachments/assets/585e2e25-bf06-4cdc-bfa5-930e0405c8d0" /> <img width="371" alt="after_3" src="https://github.com/user-attachments/assets/54585f1a-6a9b-45a3-9d77-b0bb1ace580b" /> Release Notes: - Allowed running certain Zed actions when headless
This commit is contained in:
parent
f8ab51307a
commit
ff6ac60bad
9 changed files with 178 additions and 151 deletions
|
@ -15,8 +15,8 @@ use schemars::JsonSchema;
|
|||
use serde::Deserialize;
|
||||
use settings::{SettingsStore, VsCodeSettingsSource};
|
||||
use ui::prelude::*;
|
||||
use workspace::Workspace;
|
||||
use workspace::item::{Item, ItemEvent};
|
||||
use workspace::{Workspace, with_active_or_new_workspace};
|
||||
|
||||
use crate::appearance_settings_controls::AppearanceSettingsControls;
|
||||
|
||||
|
@ -42,12 +42,8 @@ impl_actions!(zed, [ImportVsCodeSettings, ImportCursorSettings]);
|
|||
actions!(zed, [OpenSettingsEditor]);
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
cx.observe_new(|workspace: &mut Workspace, window, cx| {
|
||||
let Some(window) = window else {
|
||||
return;
|
||||
};
|
||||
|
||||
workspace.register_action(|workspace, _: &OpenSettingsEditor, window, cx| {
|
||||
cx.on_action(|_: &OpenSettingsEditor, cx| {
|
||||
with_active_or_new_workspace(cx, move |workspace, window, cx| {
|
||||
let existing = workspace
|
||||
.active_pane()
|
||||
.read(cx)
|
||||
|
@ -61,6 +57,12 @@ pub fn init(cx: &mut App) {
|
|||
workspace.add_item_to_active_pane(Box::new(settings_page), None, true, window, cx)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
cx.observe_new(|workspace: &mut Workspace, window, cx| {
|
||||
let Some(window) = window else {
|
||||
return;
|
||||
};
|
||||
|
||||
workspace.register_action(|_workspace, action: &ImportVsCodeSettings, window, cx| {
|
||||
let fs = <dyn Fs>::global(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue