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

View file

@ -1,11 +1,11 @@
use gpui::{
div, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
WindowContext,
};
use smallvec::SmallVec;
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.
///