Restore hover action in the editor (#4016)

Deals with https://github.com/zed-industries/community/issues/2304
Deals with https://github.com/zed-industries/community/issues/2394

Release Notes:

- Fixed `editor::Hover` action (and `g h` command in Vim mode) not
working
This commit is contained in:
Kirill Bulatov 2024-01-11 16:28:10 +02:00 committed by GitHub
commit b342c92495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,13 +2,13 @@ use crate::{
display_map::{InlayOffset, ToDisplayPoint},
link_go_to_definition::{InlayHighlight, RangeInEditor},
Anchor, AnchorRangeExt, DisplayPoint, Editor, EditorSettings, EditorSnapshot, EditorStyle,
ExcerptId, RangeToAnchorExt,
ExcerptId, Hover, RangeToAnchorExt,
};
use futures::FutureExt;
use gpui::{
actions, div, px, AnyElement, CursorStyle, Hsla, InteractiveElement, IntoElement, Model,
MouseButton, ParentElement, Pixels, SharedString, Size, StatefulInteractiveElement, Styled,
Task, ViewContext, WeakView,
div, px, AnyElement, CursorStyle, Hsla, InteractiveElement, IntoElement, Model, MouseButton,
ParentElement, Pixels, SharedString, Size, StatefulInteractiveElement, Styled, Task,
ViewContext, WeakView,
};
use language::{markdown, Bias, DiagnosticEntry, Language, LanguageRegistry, ParsedMarkdown};
@ -27,8 +27,6 @@ pub const MIN_POPOVER_CHARACTER_WIDTH: f32 = 20.;
pub const MIN_POPOVER_LINE_HEIGHT: Pixels = px(4.);
pub const HOVER_POPOVER_GAP: Pixels = px(10.);
actions!(editor, [Hover]);
/// Bindable action which uses the most recent selection head to trigger a hover
pub fn hover(editor: &mut Editor, _: &Hover, cx: &mut ViewContext<Editor>) {
let head = editor.selections.newest_display(cx).head();