First draft for opening Zed.log

This commit is contained in:
Isaac Clayton 2022-07-22 09:43:15 +02:00 committed by Antonio Scandurra
parent 20d45221c9
commit b20aefc842

View file

@ -52,6 +52,7 @@ actions!(
Quit, Quit,
DebugElements, DebugElements,
OpenSettings, OpenSettings,
OpenLog,
OpenKeymap, OpenKeymap,
OpenDefaultSettings, OpenDefaultSettings,
OpenDefaultKeymap, OpenDefaultKeymap,
@ -65,9 +66,10 @@ actions!(
const MIN_FONT_SIZE: f32 = 6.0; const MIN_FONT_SIZE: f32 = 6.0;
lazy_static! { lazy_static! {
pub static ref ROOT_PATH: PathBuf = dirs::home_dir() pub static ref HOME_PATH: PathBuf =
.expect("failed to determine home directory") dirs::home_dir().expect("failed to determine home directory");
.join(".zed"); pub static ref LOG_PATH: PathBuf = HOME_PATH.join("Library/Logs/Zed/Zed.log");
pub static ref ROOT_PATH: PathBuf = HOME_PATH.join(".zed");
pub static ref SETTINGS_PATH: PathBuf = ROOT_PATH.join("settings.json"); pub static ref SETTINGS_PATH: PathBuf = ROOT_PATH.join("settings.json");
pub static ref KEYMAP_PATH: PathBuf = ROOT_PATH.join("keymap.json"); pub static ref KEYMAP_PATH: PathBuf = ROOT_PATH.join("keymap.json");
} }
@ -120,6 +122,12 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
}); });
} }
}); });
cx.add_action({
let app_state = app_state.clone();
move |_: &mut Workspace, _: &OpenLog, cx: &mut ViewContext<Workspace>| {
open_config_file(&LOG_PATH, app_state.clone(), cx, || Default::default());
}
});
cx.add_action({ cx.add_action({
let app_state = app_state.clone(); let app_state = app_state.clone();
move |_: &mut Workspace, _: &OpenKeymap, cx: &mut ViewContext<Workspace>| { move |_: &mut Workspace, _: &OpenKeymap, cx: &mut ViewContext<Workspace>| {