This commit is contained in:
Keith Simmons 2022-06-13 12:18:42 -07:00
parent f78b55f92d
commit 4286a9b564
3 changed files with 10 additions and 13 deletions

View File

@ -38,6 +38,7 @@ use language::{
IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal,
TransactionId, TransactionId,
}; };
use link_go_to_definition::LinkGoToDefinitionState;
use multi_buffer::MultiBufferChunks; use multi_buffer::MultiBufferChunks;
pub use multi_buffer::{ pub use multi_buffer::{
Anchor, AnchorRangeExt, ExcerptId, ExcerptRange, MultiBuffer, MultiBufferSnapshot, ToOffset, Anchor, AnchorRangeExt, ExcerptId, ExcerptRange, MultiBuffer, MultiBufferSnapshot, ToOffset,
@ -1023,6 +1024,7 @@ impl Editor {
input_enabled: true, input_enabled: true,
leader_replica_id: None, leader_replica_id: None,
hover_state: Default::default(), hover_state: Default::default(),
link_go_to_definition_state: Default::default(),
}; };
this.end_selection(cx); this.end_selection(cx);

View File

@ -1,7 +1,4 @@
use std::{ use std::{ops::Range, time::Duration};
ops::Range,
time::{Duration, Instant},
};
use gpui::{ use gpui::{
actions, actions,
@ -60,7 +57,6 @@ pub fn hide_hover(editor: &mut Editor, cx: &mut ViewContext<Editor>) -> bool {
// only notify the context once // only notify the context once
if editor.hover_state.popover.is_some() { if editor.hover_state.popover.is_some() {
editor.hover_state.popover = None; editor.hover_state.popover = None;
editor.hover_state.hidden_at = Some(cx.background().now());
did_hide = true; did_hide = true;
cx.notify(); cx.notify();
} }
@ -242,7 +238,6 @@ fn show_hover(
#[derive(Default)] #[derive(Default)]
pub struct HoverState { pub struct HoverState {
pub popover: Option<HoverPopover>, pub popover: Option<HoverPopover>,
pub hidden_at: Option<Instant>,
pub triggered_from: Option<Anchor>, pub triggered_from: Option<Anchor>,
pub symbol_range: Option<Range<Anchor>>, pub symbol_range: Option<Range<Anchor>>,
pub task: Option<Task<Option<()>>>, pub task: Option<Task<Option<()>>>,

View File

@ -36,6 +36,13 @@ pub fn init(cx: &mut MutableAppContext) {
cx.add_action(go_to_fetched_definition); cx.add_action(go_to_fetched_definition);
} }
#[derive(Default)]
pub struct LinkGoToDefinitionState {
pub triggered_from: Option<Anchor>,
pub symbol_range: Option<Range<Anchor>>,
pub task: Option<Task<Option<()>>>,
}
pub fn fetch_definition( pub fn fetch_definition(
editor: &mut Editor, editor: &mut Editor,
FetchDefinition { point }: &FetchDefinition, FetchDefinition { point }: &FetchDefinition,
@ -49,10 +56,3 @@ pub fn go_to_fetched_definition(
cx: &mut ViewContext<Editor>, cx: &mut ViewContext<Editor>,
) { ) {
} }
#[derive(Default)]
pub struct LinkGoToDefinitionState {
pub triggered_from
pub symbol_range: Option<Range<Anchor>>,
pub task: Option<Task<Option<()>>>,
}