Fixup layout

This commit is contained in:
Julia 2023-10-11 13:41:58 -04:00
parent 801af95a13
commit 0cec0c1c1d
3 changed files with 22 additions and 5 deletions

View file

@ -1240,6 +1240,9 @@ impl CompletionsMenu {
) )
.map(|task| task.detach()); .map(|task| task.detach());
}) })
.constrained()
.with_min_width(style.autocomplete.completion_min_width)
.with_max_width(style.autocomplete.completion_max_width)
.into_any(), .into_any(),
); );
} }
@ -1250,7 +1253,7 @@ impl CompletionsMenu {
enum MultiLineDocumentation {} enum MultiLineDocumentation {}
Flex::row() Flex::row()
.with_child(list) .with_child(list.flex(1., false))
.with_children({ .with_children({
let mat = &self.matches[selected_item]; let mat = &self.matches[selected_item];
let completions = self.completions.read(); let completions = self.completions.read();
@ -1263,7 +1266,12 @@ impl CompletionsMenu {
.scrollable::<MultiLineDocumentation>(0, None, cx) .scrollable::<MultiLineDocumentation>(0, None, cx)
.with_child( .with_child(
Text::new(text.clone(), style.text.clone()).with_soft_wrap(true), Text::new(text.clone(), style.text.clone()).with_soft_wrap(true),
), )
.contained()
.with_style(style.autocomplete.alongside_docs_container)
.constrained()
.with_max_width(style.autocomplete.alongside_docs_max_width)
.flex(1., false),
), ),
Some(Documentation::MultiLineMarkdown(parsed)) => Some( Some(Documentation::MultiLineMarkdown(parsed)) => Some(
@ -1271,7 +1279,12 @@ impl CompletionsMenu {
.scrollable::<MultiLineDocumentation>(0, None, cx) .scrollable::<MultiLineDocumentation>(0, None, cx)
.with_child(render_parsed_markdown::<MultiLineDocumentation>( .with_child(render_parsed_markdown::<MultiLineDocumentation>(
parsed, &style, cx, parsed, &style, cx,
)), ))
.contained()
.with_style(style.autocomplete.alongside_docs_container)
.constrained()
.with_max_width(style.autocomplete.alongside_docs_max_width)
.flex(1., false),
), ),
_ => None, _ => None,

View file

@ -867,10 +867,12 @@ pub struct AutocompleteStyle {
pub selected_item: ContainerStyle, pub selected_item: ContainerStyle,
pub hovered_item: ContainerStyle, pub hovered_item: ContainerStyle,
pub match_highlight: HighlightStyle, pub match_highlight: HighlightStyle,
pub completion_min_width: f32,
pub completion_max_width: f32,
pub inline_docs_container: ContainerStyle, pub inline_docs_container: ContainerStyle,
pub inline_docs_color: Color, pub inline_docs_color: Color,
pub inline_docs_size_percent: f32, pub inline_docs_size_percent: f32,
pub alongside_docs_width: f32, pub alongside_docs_max_width: f32,
pub alongside_docs_container: ContainerStyle, pub alongside_docs_container: ContainerStyle,
} }

View file

@ -206,10 +206,12 @@ export default function editor(): any {
match_highlight: foreground(theme.middle, "accent", "active"), match_highlight: foreground(theme.middle, "accent", "active"),
background: background(theme.middle, "active"), background: background(theme.middle, "active"),
}, },
completion_min_width: 300,
completion_max_width: 700,
inline_docs_container: { padding: { left: 40 } }, inline_docs_container: { padding: { left: 40 } },
inline_docs_color: text(theme.middle, "sans", "disabled", {}).color, inline_docs_color: text(theme.middle, "sans", "disabled", {}).color,
inline_docs_size_percent: 0.75, inline_docs_size_percent: 0.75,
alongside_docs_width: 700, alongside_docs_max_width: 700,
alongside_docs_container: { padding: autocomplete_item.padding } alongside_docs_container: { padding: autocomplete_item.padding }
}, },
diagnostic_header: { diagnostic_header: {