Simplify usage of tooltip

Now you simply specify a text, an action and a style and GPUI will
take of rendering it properly. This is simpler compared to always
providing a custom element and should make tooltip more consistent
across the UI.
This commit is contained in:
Antonio Scandurra 2022-06-02 09:12:50 +02:00
parent 9ca9f63046
commit cc028cca78
5 changed files with 99 additions and 35 deletions

View file

@ -686,26 +686,9 @@ fn diagnostic_header_renderer(entry: DiagnosticEntry<Point>, path: ProjectPath)
})
.with_tooltip(
entry.diagnostic.group_id,
Flex::row()
.with_child(
Label::new(
"Jump to diagnostic (".to_string(),
tooltip_style.text.clone(),
)
.boxed(),
)
.with_child(
KeystrokeLabel::new(
Box::new(editor::OpenExcerpts),
Default::default(),
tooltip_style.text.clone(),
)
.boxed(),
)
.with_child(Label::new(")".to_string(), tooltip_style.text).boxed())
.contained()
.with_style(tooltip_style.container)
.boxed(),
"Jump to diagnostic".to_string(),
Some(Box::new(editor::OpenExcerpts)),
tooltip_style,
cx,
)
.aligned()