Use editor's overlay implementation

This commit is contained in:
Conrad Irwin 2023-11-27 11:48:10 -07:00
parent 212d9254e1
commit 82f6f77117
2 changed files with 13 additions and 26 deletions

View file

@ -39,13 +39,12 @@ use futures::FutureExt;
use fuzzy::{StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate};
use git::diff_hunk_to_display; use git::diff_hunk_to_display;
use gpui::{ use gpui::{
actions, div, overlay, point, prelude::*, px, relative, rems, size, uniform_list, Action, actions, div, point, prelude::*, px, relative, rems, size, uniform_list, Action, AnyElement,
AnyElement, AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Context, AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Context, ElementId,
ElementId, EventEmitter, FocusHandle, FocusableView, FontFeatures, FontStyle, FontWeight, EventEmitter, FocusHandle, FocusableView, FontFeatures, FontStyle, FontWeight, HighlightStyle,
HighlightStyle, Hsla, InputHandler, InteractiveText, KeyContext, Model, MouseButton, Hsla, InputHandler, InteractiveText, KeyContext, Model, MouseButton, ParentElement, Pixels,
ParentElement, Pixels, Render, RenderOnce, SharedString, Styled, StyledText, Subscription, Render, RenderOnce, SharedString, Styled, StyledText, Subscription, Task, TextRun, TextStyle,
Task, TextRun, TextStyle, UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext,
WhiteSpace, WindowContext,
}; };
use highlight_matching_bracket::refresh_matching_bracket_highlights; use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState}; use hover_popover::{hide_hover, HoverState};
@ -1369,23 +1368,11 @@ impl CompletionsMenu {
.track_scroll(self.scroll_handle.clone()) .track_scroll(self.scroll_handle.clone())
.with_width_from_item(widest_completion_ix); .with_width_from_item(widest_completion_ix);
// Old:
// Popover::new()
// .child(list)
// .when_some(multiline_docs, |popover, multiline_docs| {
// popover.aside(multiline_docs)
// })
// .into_any_element()
overlay()
.anchor(gpui::AnchorCorner::TopLeft)
.child(
Popover::new() Popover::new()
.child(list) .child(list)
.when_some(multiline_docs, |popover, multiline_docs| { .when_some(multiline_docs, |popover, multiline_docs| {
popover.aside(multiline_docs) popover.aside(multiline_docs)
}), })
)
.into_any_element() .into_any_element()
} }

View file

@ -1,11 +1,11 @@
use gpui::{ use gpui::{
div, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
WindowContext, WindowContext,
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
use theme2::ActiveTheme; use theme2::ActiveTheme;
use crate::{h_stack, v_stack, StyledExt}; use crate::{v_stack, StyledExt};
/// A popover is used to display a menu or show some options. /// A popover is used to display a menu or show some options.
/// ///