diff --git a/Cargo.lock b/Cargo.lock index 70586ed6f4..64bfe4edf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5115,7 +5115,7 @@ dependencies = [ "project2", "pulldown-cmark", "rand 0.8.5", - "rich_text", + "rich_text2", "schemars", "serde", "serde_derive", @@ -6947,6 +6947,24 @@ dependencies = [ "util", ] +[[package]] +name = "rich_text2" +version = "0.1.0" +dependencies = [ + "anyhow", + "collections", + "futures 0.3.28", + "gpui2", + "language2", + "lazy_static", + "pulldown-cmark", + "smallvec", + "smol", + "sum_tree", + "theme2", + "util", +] + [[package]] name = "ring" version = "0.16.20" @@ -8876,7 +8894,7 @@ name = "theme2" version = "0.1.0" dependencies = [ "anyhow", - "fs", + "fs2", "gpui2", "indexmap 1.9.3", "parking_lot 0.11.2", diff --git a/crates/rich_text2/Cargo.toml b/crates/rich_text2/Cargo.toml new file mode 100644 index 0000000000..4eee1e107b --- /dev/null +++ b/crates/rich_text2/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "rich_text2" +version = "0.1.0" +edition = "2021" +publish = false + +[lib] +path = "src/rich_text.rs" +doctest = false + +[features] +test-support = [ + "gpui/test-support", + "util/test-support", +] + +[dependencies] +collections = { path = "../collections" } +gpui = { package = "gpui2", path = "../gpui2" } +sum_tree = { path = "../sum_tree" } +theme = { package = "theme2", path = "../theme2" } +language = { package = "language2", path = "../language2" } +util = { path = "../util" } +anyhow.workspace = true +futures.workspace = true +lazy_static.workspace = true +pulldown-cmark = { version = "0.9.2", default-features = false } +smallvec.workspace = true +smol.workspace = true diff --git a/crates/rich_text2/src/rich_text.rs b/crates/rich_text2/src/rich_text.rs index 9a8f4a1457..48b530b7c5 100644 --- a/crates/rich_text2/src/rich_text.rs +++ b/crates/rich_text2/src/rich_text.rs @@ -2,14 +2,8 @@ use std::{ops::Range, sync::Arc}; use anyhow::bail; use futures::FutureExt; -use gpui::{ - elements::Text, - fonts::{HighlightStyle, Underline, Weight}, - platform::{CursorStyle, MouseButton}, - AnyElement, CursorRegion, Element, MouseRegion, ViewContext, -}; +use gpui::{AnyElement, FontStyle, FontWeight, HighlightStyle, UnderlineStyle}; use language::{HighlightId, Language, LanguageRegistry}; -use theme::{RichTextStyle, SyntaxTheme}; use util::RangeExt; #[derive(Debug, Clone, PartialEq, Eq)] @@ -64,9 +58,9 @@ pub struct Mention { impl RichText { pub fn element( &self, - syntax: Arc, - style: RichTextStyle, - cx: &mut ViewContext, + // syntax: Arc, + // style: RichTextStyle, + // cx: &mut ViewContext, ) -> AnyElement { todo!(); @@ -203,10 +197,10 @@ pub fn render_markdown_mut( data.text.push_str(t.as_ref()); let mut style = HighlightStyle::default(); if bold_depth > 0 { - style.weight = Some(Weight::BOLD); + style.font_weight = Some(FontWeight::BOLD); } if italic_depth > 0 { - style.italic = Some(true); + style.font_style = Some(FontStyle::Italic); } if let Some(link_url) = link_url.clone() { data.region_ranges.push(prev_len..data.text.len()); @@ -214,7 +208,7 @@ pub fn render_markdown_mut( link_url: Some(link_url), background_kind: None, }); - style.underline = Some(Underline { + style.underline = Some(UnderlineStyle { thickness: 1.0.into(), ..Default::default() }); @@ -244,7 +238,7 @@ pub fn render_markdown_mut( data.highlights.push(( prev_len..data.text.len(), Highlight::Highlight(HighlightStyle { - underline: Some(Underline { + underline: Some(UnderlineStyle { thickness: 1.0.into(), ..Default::default() }), diff --git a/crates/theme2/Cargo.toml b/crates/theme2/Cargo.toml index a051468b00..5a8448372c 100644 --- a/crates/theme2/Cargo.toml +++ b/crates/theme2/Cargo.toml @@ -17,7 +17,7 @@ doctest = false [dependencies] anyhow.workspace = true -fs = { path = "../fs" } +fs = { package = "fs2", path = "../fs2" } gpui = { package = "gpui2", path = "../gpui2" } indexmap = "1.6.2" parking_lot.workspace = true @@ -32,5 +32,5 @@ util = { path = "../util" } [dev-dependencies] gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] } -fs = { path = "../fs", features = ["test-support"] } +fs = { package = "fs2", path = "../fs2", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }