Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Wire up journal
Joseph T. Lyons88d05fd8140f
diff --git a/crates/journal2/src/journal2.rs b/crates/journal2/src/journal2.rsindex 20d520e36e4..95ef17a358e 100644--- a/crates/journal2/src/journal2.rs+++ b/crates/journal2/src/journal2.rs@@ -1,6 +1,6 @@use anyhow::Result;use chrono::{Datelike, Local, NaiveTime, Timelike};-use gpui::AppContext;+use gpui::{actions, AppContext, ViewContext};use schemars::JsonSchema;use serde::{Deserialize, Serialize};use settings2::Settings;@@ -9,11 +9,9 @@ use std::{path::{Path, PathBuf},sync::Arc,};-use workspace2::AppState;-// use zed::AppState;+use workspace2::{AppState, Workspace};-// todo!();-// actions!(journal, [NewJournalEntry]);+actions!(journal, [NewJournalEntry]);#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]pub struct JournalSettings {@@ -55,8 +53,14 @@ impl settings2::Settings for JournalSettings {pub fn init(_: Arc<AppState>, cx: &mut AppContext) {JournalSettings::register(cx);- // todo!()- // cx.add_global_action(move |_: &NewJournalEntry, cx| new_journal_entry(app_state.clone(), cx));+ cx.observe_new_views(+ |workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {+ workspace.register_action(|workspace, _: &NewJournalEntry, cx| {+ new_journal_entry(workspace.app_state().clone(), cx);+ });+ },+ )+ .detach();}pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut AppContext) {diff --git a/crates/zed2/src/main.rs b/crates/zed2/src/main.rsindex a24fb7377d9..06eb4320141 100644--- a/crates/zed2/src/main.rs+++ b/crates/zed2/src/main.rs@@ -215,7 +215,7 @@ fn main() {vim::init(cx);terminal_view::init(cx);- // journal2::init(app_state.clone(), cx);+ journal::init(app_state.clone(), cx);language_selector::init(cx);theme_selector::init(cx);language_tools::init(cx);