Layout completion single-line documentation to the right of item
This commit is contained in:
parent
2b9570e3e7
commit
ae71d1ad5d
1 changed files with 15 additions and 6 deletions
|
@ -98,7 +98,7 @@ pub use sum_tree::Bias;
|
||||||
use sum_tree::TreeMap;
|
use sum_tree::TreeMap;
|
||||||
use text::{OffsetUtf16, Rope};
|
use text::{OffsetUtf16, Rope};
|
||||||
use theme::{ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, ThemeColors, ThemeSettings};
|
use theme::{ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, ThemeColors, ThemeSettings};
|
||||||
use ui::{h_stack, ButtonSize, ButtonStyle, Icon, IconButton, Popover, Tooltip};
|
use ui::{h_stack, ButtonSize, ButtonStyle, Icon, IconButton, List, Popover, Tooltip};
|
||||||
use ui::{prelude::*, IconSize};
|
use ui::{prelude::*, IconSize};
|
||||||
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
|
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
|
||||||
use workspace::{searchable::SearchEvent, ItemNavHistory, Pane, SplitDirection, ViewId, Workspace};
|
use workspace::{searchable::SearchEvent, ItemNavHistory, Pane, SplitDirection, ViewId, Workspace};
|
||||||
|
@ -1202,6 +1202,7 @@ impl CompletionsMenu {
|
||||||
.on_mouse_down(MouseButton::Left, |_, cx| cx.stop_propagation())
|
.on_mouse_down(MouseButton::Left, |_, cx| cx.stop_propagation())
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
let list = uniform_list(
|
let list = uniform_list(
|
||||||
cx.view().clone(),
|
cx.view().clone(),
|
||||||
"completions",
|
"completions",
|
||||||
|
@ -1239,19 +1240,27 @@ impl CompletionsMenu {
|
||||||
.with_highlights(&style.text, highlights);
|
.with_highlights(&style.text, highlights);
|
||||||
let documentation_label =
|
let documentation_label =
|
||||||
if let Some(Documentation::SingleLine(text)) = documentation {
|
if let Some(Documentation::SingleLine(text)) = documentation {
|
||||||
Some(SharedString::from(text.clone()))
|
if text.trim().is_empty() {
|
||||||
.filter(|text| !text.trim().is_empty())
|
None
|
||||||
|
} else {
|
||||||
|
Some(
|
||||||
|
h_stack()
|
||||||
|
.flex_grow()
|
||||||
|
.child(div().flex_grow())
|
||||||
|
.child(Label::new(text.clone())),
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
div()
|
h_stack()
|
||||||
.id(mat.candidate_id)
|
.id(mat.candidate_id)
|
||||||
.min_w(px(220.))
|
.w(px(540.))
|
||||||
.max_w(px(540.))
|
|
||||||
.whitespace_nowrap()
|
.whitespace_nowrap()
|
||||||
.overflow_hidden()
|
.overflow_hidden()
|
||||||
.text_ui()
|
.text_ui()
|
||||||
|
.gap_2()
|
||||||
.px_1()
|
.px_1()
|
||||||
.rounded(px(4.))
|
.rounded(px(4.))
|
||||||
.bg(cx.theme().colors().ghost_element_background)
|
.bg(cx.theme().colors().ghost_element_background)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue