🚧 Completion & Popover Styles 🚧 (#3406)
TODO: - [ ] Add y axis padding to list instead of popover container - [x] Combined max-width between completions list and docs - [ ] Allow docs to be taller than completion list - [x] Use the workspace bounds to set doc position - [ ] Clean up markdown styles - [x] (🐜) Changing items should set doc scroll position to the top - [x] (🐜) popovers should render on top of all panes - [ ] (extra) Try adding code block backgrounds to md rendering - [ ] (extra) Use ui font for markdown text, buffer font for markdown code. - [ ] (extra) Try lining up inline code in completions menu [[PR Description]] Release Notes: - N/A
This commit is contained in:
commit
84ee833d0c
4 changed files with 28 additions and 20 deletions
|
@ -1273,6 +1273,13 @@ impl CompletionsMenu {
|
||||||
multiline_docs.map(|div| {
|
multiline_docs.map(|div| {
|
||||||
div.id("multiline_docs")
|
div.id("multiline_docs")
|
||||||
.max_h(max_height)
|
.max_h(max_height)
|
||||||
|
.flex_1()
|
||||||
|
.px_1p5()
|
||||||
|
.py_1()
|
||||||
|
.min_w(px(260.))
|
||||||
|
.max_w(px(640.))
|
||||||
|
.w(px(500.))
|
||||||
|
.text_ui()
|
||||||
.overflow_y_scroll()
|
.overflow_y_scroll()
|
||||||
// Prevent a mouse down on documentation from being propagated to the editor,
|
// Prevent a mouse down on documentation from being propagated to the editor,
|
||||||
// because that would move the cursor.
|
// because that would move the cursor.
|
||||||
|
@ -1327,13 +1334,18 @@ impl CompletionsMenu {
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.id(mat.candidate_id)
|
.id(mat.candidate_id)
|
||||||
.min_w(px(300.))
|
.min_w(px(220.))
|
||||||
.max_w(px(700.))
|
.max_w(px(540.))
|
||||||
.whitespace_nowrap()
|
.whitespace_nowrap()
|
||||||
.overflow_hidden()
|
.overflow_hidden()
|
||||||
.bg(gpui::green())
|
.text_ui()
|
||||||
.hover(|style| style.bg(gpui::blue()))
|
.px_1()
|
||||||
.when(item_ix == selected_item, |div| div.bg(gpui::red()))
|
.rounded(px(4.))
|
||||||
|
.bg(cx.theme().colors().ghost_element_background)
|
||||||
|
.hover(|style| style.bg(cx.theme().colors().ghost_element_hover))
|
||||||
|
.when(item_ix == selected_item, |div| {
|
||||||
|
div.bg(cx.theme().colors().ghost_element_selected)
|
||||||
|
})
|
||||||
.on_mouse_down(
|
.on_mouse_down(
|
||||||
MouseButton::Left,
|
MouseButton::Left,
|
||||||
cx.listener(move |editor, event, cx| {
|
cx.listener(move |editor, event, cx| {
|
||||||
|
|
|
@ -105,6 +105,7 @@ impl Element for Overlay {
|
||||||
origin: Point::zero(),
|
origin: Point::zero(),
|
||||||
size: cx.viewport_size(),
|
size: cx.viewport_size(),
|
||||||
};
|
};
|
||||||
|
dbg!(limits);
|
||||||
|
|
||||||
match self.fit_mode {
|
match self.fit_mode {
|
||||||
OverlayFitMode::SnapToWindow => {
|
OverlayFitMode::SnapToWindow => {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
|
div, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
use theme2::ActiveTheme;
|
||||||
|
|
||||||
use crate::{v_stack, StyledExt};
|
use crate::{v_stack, StyledExt};
|
||||||
|
|
||||||
|
@ -43,22 +44,16 @@ impl RenderOnce for Popover {
|
||||||
type Rendered = Div;
|
type Rendered = Div;
|
||||||
|
|
||||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||||
v_stack()
|
div()
|
||||||
.relative()
|
.flex()
|
||||||
.elevation_2(cx)
|
.gap_1()
|
||||||
.p_1()
|
.child(v_stack().elevation_2(cx).px_1().children(self.children))
|
||||||
.children(self.children)
|
|
||||||
.when_some(self.aside, |this, aside| {
|
.when_some(self.aside, |this, aside| {
|
||||||
// TODO: This will statically position the aside to the top right of the popover.
|
|
||||||
// We should update this to use gpui2::overlay avoid collisions with the window edges.
|
|
||||||
this.child(
|
this.child(
|
||||||
v_stack()
|
v_stack()
|
||||||
.top_0()
|
|
||||||
.left_full()
|
|
||||||
.ml_1()
|
|
||||||
.absolute()
|
|
||||||
.elevation_2(cx)
|
.elevation_2(cx)
|
||||||
.p_1()
|
.bg(cx.theme().colors().surface_background)
|
||||||
|
.px_1()
|
||||||
.child(aside),
|
.child(aside),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use gpui::{Styled, WindowContext};
|
use gpui::{px, Styled, WindowContext};
|
||||||
use theme2::ActiveTheme;
|
use theme2::ActiveTheme;
|
||||||
|
|
||||||
use crate::{ElevationIndex, UITextSize};
|
use crate::{ElevationIndex, UITextSize};
|
||||||
|
@ -6,7 +6,7 @@ use crate::{ElevationIndex, UITextSize};
|
||||||
fn elevated<E: Styled>(this: E, cx: &mut WindowContext, index: ElevationIndex) -> E {
|
fn elevated<E: Styled>(this: E, cx: &mut WindowContext, index: ElevationIndex) -> E {
|
||||||
this.bg(cx.theme().colors().elevated_surface_background)
|
this.bg(cx.theme().colors().elevated_surface_background)
|
||||||
.z_index(index.z_index())
|
.z_index(index.z_index())
|
||||||
.rounded_lg()
|
.rounded(px(8.))
|
||||||
.border()
|
.border()
|
||||||
.border_color(cx.theme().colors().border_variant)
|
.border_color(cx.theme().colors().border_variant)
|
||||||
.shadow(index.shadow())
|
.shadow(index.shadow())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue