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_highlighter(
15 &mut self,
16 highlighter: crate::Highlighter,
17 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
18 );
19
20 fn set_markdown_layout(&mut self, layout: crate::Layout);
22
23 #[cfg(feature = "mermaid")]
25 fn set_mermaid_zoom(&mut self, zoom: crate::mermaid::Zoom);
26
27 fn set_link_handler(&mut self, handler: crate::LinkHandler);
29
30 fn set_marks(&mut self, marks: crate::Marks);
32
33 fn set_mark_paint(&mut self, paint: crate::marks::Painter);
35
36 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint);
38
39 fn set_link_preview(&mut self, preview: crate::LinkPreview);
41
42 fn set_link_card(&mut self, card: crate::LinkCard);
44
45 fn set_link_hover(&mut self, hover: crate::LinkHover);
47
48 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static);
50
51 fn set_typography(&mut self, typography: crate::Typography);
53
54 fn highlight_languages(&self) -> &[gpui::SharedString];
56
57 fn markdown_layout(&self) -> crate::Layout;
59
60 fn typography(&self) -> crate::Typography;
62
63 fn marks(&self) -> crate::Marks;
65
66 fn source_style(&self) -> crate::SourceStyle;
68}
69
70impl AppExt for App {
71 fn set_block_renderer(&mut self, renderer: crate::BlockRenderer) {
72 crate::block::set_block_renderer(self, renderer)
73 }
74
75 fn set_find_paint(&mut self, paint: crate::FindPaint) {
76 crate::find::set_find_paint(self, paint)
77 }
78
79 fn set_highlighter(
80 &mut self,
81 highlighter: crate::Highlighter,
82 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
83 ) {
84 crate::highlight::set_highlighter(self, highlighter, languages)
85 }
86
87 fn set_markdown_layout(&mut self, layout: crate::Layout) {
88 crate::layout::set_layout(self, layout)
89 }
90
91 #[cfg(feature = "mermaid")]
92 fn set_mermaid_zoom(&mut self, zoom: crate::mermaid::Zoom) {
93 crate::mermaid::set_zoom(self, zoom)
94 }
95
96 fn set_link_handler(&mut self, handler: crate::LinkHandler) {
97 crate::link::set_link_handler(self, handler)
98 }
99
100 fn set_marks(&mut self, marks: crate::Marks) {
101 crate::marks::set_marks(self, marks)
102 }
103
104 fn set_mark_paint(&mut self, paint: crate::marks::Painter) {
105 crate::marks::set_mark_paint(self, paint)
106 }
107
108 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint) {
109 crate::marks::set_highlight_paint(self, paint)
110 }
111
112 fn set_link_preview(&mut self, preview: crate::LinkPreview) {
113 crate::preview::set_link_preview(self, preview)
114 }
115
116 fn set_link_card(&mut self, card: crate::LinkCard) {
117 crate::preview::set_link_card(self, card)
118 }
119
120 fn set_link_hover(&mut self, hover: crate::LinkHover) {
121 crate::preview::set_link_hover(self, hover)
122 }
123
124 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static) {
125 crate::source_style::set_source_style(self, style)
126 }
127
128 fn set_typography(&mut self, typography: crate::Typography) {
129 crate::typography::set_typography(self, typography)
130 }
131
132 fn highlight_languages(&self) -> &[gpui::SharedString] {
133 crate::highlight::languages(self)
134 }
135
136 fn markdown_layout(&self) -> crate::Layout {
137 crate::layout::Layout::of(self)
138 }
139
140 fn typography(&self) -> crate::Typography {
141 crate::typography::Typography::of(self)
142 }
143
144 fn marks(&self) -> crate::Marks {
145 crate::marks::Marks::of(self)
146 }
147
148 fn source_style(&self) -> crate::SourceStyle {
149 crate::source_style::SourceStyle::of(self)
150 }
151}