1use gpui::App;
4
5pub trait AppExt {
7 fn set_block_renderer(&mut self, renderer: crate::BlockRenderer);
9
10 fn set_find_paint(&mut self, paint: crate::FindPaint);
12
13 fn set_comment_paint(&mut self, paint: crate::CommentPaint);
15
16 fn set_highlighter(
18 &mut self,
19 highlighter: crate::Highlighter,
20 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
21 );
22
23 fn set_markdown_layout(&mut self, layout: crate::Layout);
25
26 #[cfg(feature = "mermaid")]
28 fn set_mermaid_zoom(&mut self, zoom: crate::mermaid::Zoom);
29
30 fn set_links<L: crate::Links>(&mut self);
32
33 fn set_marks(&mut self, marks: crate::Marks);
35
36 fn set_mark_paint(&mut self, paint: crate::marks::Painter);
38
39 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint);
41
42 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static);
44
45 fn set_typography(&mut self, typography: crate::Typography);
47
48 fn highlight_languages(&self) -> &[gpui::SharedString];
50
51 fn markdown_layout(&self) -> crate::Layout;
53
54 fn typography(&self) -> crate::Typography;
56
57 fn marks(&self) -> crate::Marks;
59
60 fn source_style(&self) -> crate::SourceStyle;
62}
63
64impl AppExt for App {
65 fn set_block_renderer(&mut self, renderer: crate::BlockRenderer) {
66 crate::block::set_block_renderer(self, renderer)
67 }
68
69 fn set_find_paint(&mut self, paint: crate::FindPaint) {
70 crate::find::set_find_paint(self, paint)
71 }
72
73 fn set_comment_paint(&mut self, paint: crate::CommentPaint) {
74 crate::comment::set_comment_paint(self, paint)
75 }
76
77 fn set_highlighter(
78 &mut self,
79 highlighter: crate::Highlighter,
80 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
81 ) {
82 crate::highlight::set_highlighter(self, highlighter, languages)
83 }
84
85 fn set_markdown_layout(&mut self, layout: crate::Layout) {
86 crate::layout::set_layout(self, layout)
87 }
88
89 #[cfg(feature = "mermaid")]
90 fn set_mermaid_zoom(&mut self, zoom: crate::mermaid::Zoom) {
91 crate::mermaid::set_zoom(self, zoom)
92 }
93
94 fn set_links<L: crate::Links>(&mut self) {
95 crate::link::set_links::<L>(self)
96 }
97
98 fn set_marks(&mut self, marks: crate::Marks) {
99 crate::marks::set_marks(self, marks)
100 }
101
102 fn set_mark_paint(&mut self, paint: crate::marks::Painter) {
103 crate::marks::set_mark_paint(self, paint)
104 }
105
106 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint) {
107 crate::marks::set_highlight_paint(self, paint)
108 }
109
110 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static) {
111 crate::source_style::set_source_style(self, style)
112 }
113
114 fn set_typography(&mut self, typography: crate::Typography) {
115 crate::typography::set_typography(self, typography)
116 }
117
118 fn highlight_languages(&self) -> &[gpui::SharedString] {
119 crate::highlight::languages(self)
120 }
121
122 fn markdown_layout(&self) -> crate::Layout {
123 crate::layout::Layout::of(self)
124 }
125
126 fn typography(&self) -> crate::Typography {
127 crate::typography::Typography::of(self)
128 }
129
130 fn marks(&self) -> crate::Marks {
131 crate::marks::Marks::of(self)
132 }
133
134 fn source_style(&self) -> crate::SourceStyle {
135 crate::source_style::SourceStyle::of(self)
136 }
137}