refactor the parser
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m56s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled

This commit is contained in:
2026-03-03 15:03:23 +07:00
parent 29c7a82d1d
commit e73d4e3da8
7 changed files with 240 additions and 17 deletions

View File

@@ -702,7 +702,7 @@ impl ChatPanel {
let text = self
.rendered_texts_by_id
.entry(rendered.id)
.or_insert_with(|| RenderedText::new(&rendered.content, &[]))
.or_insert_with(|| RenderedText::new(&rendered.content, &rendered.mentions))
.element(ix.into(), window, cx);
self.render_text_message(ix, rendered, text, cx)

View File

@@ -1,6 +1,7 @@
use std::ops::Range;
use std::sync::Arc;
use chat::Mention;
use common::RangeExt;
use gpui::{
AnyElement, App, ElementId, FontStyle, FontWeight, HighlightStyle, InteractiveText,
@@ -24,11 +25,6 @@ impl From<HighlightStyle> for Highlight {
}
}
#[derive(Debug)]
pub struct Mention {
pub range: Range<usize>,
}
#[derive(Default)]
pub struct RenderedText {
pub text: SharedString,
@@ -96,7 +92,10 @@ impl RenderedText {
}
}
Highlight::Mention => HighlightStyle {
font_weight: Some(FontWeight::BOLD),
underline: Some(UnderlineStyle {
thickness: 1.0.into(),
..Default::default()
}),
..Default::default()
},
Highlight::Highlight(highlight) => *highlight,