Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add welcome crate and associated types
Mikayla Maki9401ef223d97
diff --git a/Cargo.lock b/Cargo.lockindex 2e7997458ed..607f47b5cf1 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -8013,6 +8013,20 @@ version = "0.1.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"+[[package]]+name = "welcome"+version = "0.1.0"+dependencies = [+ "anyhow",+ "gpui",+ "log",+ "project",+ "settings",+ "theme",+ "util",+ "workspace",+]+[[package]]name = "wepoll-ffi"version = "0.1.2"@@ -8459,6 +8473,7 @@ dependencies = ["util","uuid 1.2.2","vim",+ "welcome","workspace",]diff --git a/Cargo.toml b/Cargo.tomlindex c74a76cccef..feb80633c4f 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -58,6 +58,7 @@ members = ["crates/util","crates/vim","crates/workspace",+ "crates/welcome","crates/zed",]default-members = ["crates/zed"]diff --git a/crates/welcome/Cargo.toml b/crates/welcome/Cargo.tomlnew file mode 100644index 00000000000..6ac312c37ff--- /dev/null+++ b/crates/welcome/Cargo.toml@@ -0,0 +1,21 @@+[package]+name = "welcome"+version = "0.1.0"+edition = "2021"+publish = false++[lib]+path = "src/welcome.rs"++[features]+test-support = []++[dependencies]+anyhow = "1.0.38"+log = "0.4"+gpui = { path = "../gpui" }+project = { path = "../project" }+settings = { path = "../settings" }+theme = { path = "../theme" }+util = { path = "../util" }+workspace = { path = "../workspace" }\ No newline at end of filediff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rsnew file mode 100644index 00000000000..1deede76119--- /dev/null+++ b/crates/welcome/src/welcome.rs@@ -0,0 +1,51 @@+use gpui::{+ actions,+ elements::{Flex, Label, ParentElement},+ Element, Entity, MutableAppContext, View,+};+use settings::Settings;+use workspace::{item::Item, Workspace};++actions!(welcome, [ShowWelcome]);++pub fn init(cx: &mut MutableAppContext) {+ cx.add_action(|workspace: &mut Workspace, _: &ShowWelcome, cx| {+ let welcome_page = cx.add_view(|_cx| WelcomePage);+ workspace.add_item(Box::new(welcome_page), cx)+ })+}++struct WelcomePage;++impl Entity for WelcomePage {+ type Event = ();+}++impl View for WelcomePage {+ fn ui_name() -> &'static str {+ "WelcomePage"+ }++ fn render(&mut self, cx: &mut gpui::RenderContext<'_, Self>) -> gpui::ElementBox {+ let theme = &cx.global::<Settings>().theme;+ Label::new("Welcome page", theme.editor.hover_popover.prose.clone()).boxed()+ }+}++impl Item for WelcomePage {+ fn tab_content(+ &self,+ _detail: Option<usize>,+ style: &theme::Tab,+ _cx: &gpui::AppContext,+ ) -> gpui::ElementBox {+ Flex::row()+ .with_child(+ Label::new("Welcome to Zed!", style.label.clone())+ .aligned()+ .contained()+ .boxed(),+ )+ .boxed()+ }+}diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.tomlindex 19c9a3d7277..d3b6e4810fa 100644--- a/crates/zed/Cargo.toml+++ b/crates/zed/Cargo.toml@@ -58,6 +58,7 @@ theme_testbench = { path = "../theme_testbench" }util = { path = "../util" }vim = { path = "../vim" }workspace = { path = "../workspace" }+welcome = { path = "../welcome" }anyhow = "1.0.38"async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }async-tar = "0.4.2"diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex b9e3ed550be..cc930774d58 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -189,6 +189,7 @@ fn main() {zed::init(&app_state, cx);collab_ui::init(app_state.clone(), cx);feedback::init(app_state.clone(), cx);+ welcome::init(cx);cx.set_menus(menus::menus());