BlueGit

ict rusty-teams

Files

rusty-teams / vendor / gpui-component / src / input / popovers / mod.rs

mod.rs

mod.rs 1.4 KiB Download Raw
1mod code_action_menu;
2mod completion_menu;
3mod diagnostic_popover;
4mod hover_popover;
5
6pub(crate) use code_action_menu::*;
7pub(crate) use completion_menu::*;
8pub(crate) use diagnostic_popover::*;
9pub(crate) use hover_popover::*;
10
11use gpui::{
12 App, Div, ElementId, InteractiveElement as _, SharedString, Stateful, StyleRefinement,
13 Styled as _, Window, div, px, rems,
14};
15
16use crate::{
17 ActiveTheme, ThemeStyled as _,
18 text::{TextView, TextViewStyle},
19};
20
21pub(super) fn render_markdown(
22 id: impl Into<ElementId>,
23 markdown: impl Into<SharedString>,
24 _: &mut Window,
25 cx: &mut App,
26) -> TextView {
27 TextView::markdown(id, markdown)
28 .style(
29 TextViewStyle::default()
30 .paragraph_gap(rems(0.5))
31 .heading_font_size(|level, rem_size| match level {
32 1..=3 => rem_size * 1,
33 4 => rem_size * 0.9,
34 _ => rem_size * 0.8,
35 })
36 .code_block(
37 StyleRefinement::default()
38 .bg(cx.theme().transparent)
39 .p_0()
40 .text_size(px(11.)),
41 ),
42 )
43 .selectable(true)
44}
45
46pub(super) fn editor_popover(id: impl Into<ElementId>, window: &Window, cx: &App) -> Stateful<Div> {
47 div()
48 .id(id)
49 .flex_none()
50 .occlude()
51 .popover_style(window, cx)
52 .text_xs()
53 .p_1()
54}