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 fn set_link_handler(&mut self, handler: crate::LinkHandler);
25
26 fn set_marks(&mut self, marks: crate::Marks);
28
29 fn set_mark_paint(&mut self, paint: crate::marks::Painter);
31
32 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint);
34
35 fn set_link_preview(&mut self, preview: crate::LinkPreview);
37
38 fn set_link_card(&mut self, card: crate::LinkCard);
40
41 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static);
43
44 fn set_typography(&mut self, typography: crate::Typography);
46
47 fn highlight_languages(&self) -> &[gpui::SharedString];
49
50 fn markdown_layout(&self) -> crate::Layout;
52
53 fn typography(&self) -> crate::Typography;
55
56 fn marks(&self) -> crate::Marks;
58
59 fn source_style(&self) -> crate::SourceStyle;
61}
62
63impl AppExt for App {
64 fn set_block_renderer(&mut self, renderer: crate::BlockRenderer) {
65 crate::block::set_block_renderer(self, renderer)
66 }
67
68 fn set_find_paint(&mut self, paint: crate::FindPaint) {
69 crate::find::set_find_paint(self, paint)
70 }
71
72 fn set_highlighter(
73 &mut self,
74 highlighter: crate::Highlighter,
75 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
76 ) {
77 crate::highlight::set_highlighter(self, highlighter, languages)
78 }
79
80 fn set_markdown_layout(&mut self, layout: crate::Layout) {
81 crate::layout::set_layout(self, layout)
82 }
83
84 fn set_link_handler(&mut self, handler: crate::LinkHandler) {
85 crate::link::set_link_handler(self, handler)
86 }
87
88 fn set_marks(&mut self, marks: crate::Marks) {
89 crate::marks::set_marks(self, marks)
90 }
91
92 fn set_mark_paint(&mut self, paint: crate::marks::Painter) {
93 crate::marks::set_mark_paint(self, paint)
94 }
95
96 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint) {
97 crate::marks::set_highlight_paint(self, paint)
98 }
99
100 fn set_link_preview(&mut self, preview: crate::LinkPreview) {
101 crate::preview::set_link_preview(self, preview)
102 }
103
104 fn set_link_card(&mut self, card: crate::LinkCard) {
105 crate::preview::set_link_card(self, card)
106 }
107
108 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static) {
109 crate::source_style::set_source_style(self, style)
110 }
111
112 fn set_typography(&mut self, typography: crate::Typography) {
113 crate::typography::set_typography(self, typography)
114 }
115
116 fn highlight_languages(&self) -> &[gpui::SharedString] {
117 crate::highlight::languages(self)
118 }
119
120 fn markdown_layout(&self) -> crate::Layout {
121 crate::layout::Layout::of(self)
122 }
123
124 fn typography(&self) -> crate::Typography {
125 crate::typography::Typography::of(self)
126 }
127
128 fn marks(&self) -> crate::Marks {
129 crate::marks::Marks::of(self)
130 }
131
132 fn source_style(&self) -> crate::SourceStyle {
133 crate::source_style::SourceStyle::of(self)
134 }
135}