mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
parent
583ce44359
commit
4195f27964
@ -7264,10 +7264,6 @@ impl Editor {
|
||||
split: bool,
|
||||
cx: &mut ViewContext<Editor>,
|
||||
) {
|
||||
let Some(workspace) = self.workspace() else {
|
||||
return;
|
||||
};
|
||||
let pane = workspace.read(cx).active_pane().clone();
|
||||
// If there is one definition, just open it directly
|
||||
if definitions.len() == 1 {
|
||||
let definition = definitions.pop().unwrap();
|
||||
@ -7285,6 +7281,11 @@ impl Editor {
|
||||
let target = target_task.await.context("target resolution task")?;
|
||||
if let Some(target) = target {
|
||||
editor.update(&mut cx, |editor, cx| {
|
||||
let Some(workspace) = editor.workspace() else {
|
||||
return;
|
||||
};
|
||||
let pane = workspace.read(cx).active_pane().clone();
|
||||
|
||||
let range = target.range.to_offset(target.buffer.read(cx));
|
||||
let range = editor.range_for_match(&range);
|
||||
if Some(&target.buffer) == editor.buffer.read(cx).as_singleton().as_ref() {
|
||||
@ -7325,7 +7326,7 @@ impl Editor {
|
||||
} else if !definitions.is_empty() {
|
||||
let replica_id = self.replica_id(cx);
|
||||
cx.spawn(|editor, mut cx| async move {
|
||||
let (title, location_tasks) = editor
|
||||
let (title, location_tasks, workspace) = editor
|
||||
.update(&mut cx, |editor, cx| {
|
||||
let title = definitions
|
||||
.iter()
|
||||
@ -7353,7 +7354,7 @@ impl Editor {
|
||||
HoverLink::Url(_) => Task::ready(Ok(None)),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
(title, location_tasks)
|
||||
(title, location_tasks, editor.workspace().clone())
|
||||
})
|
||||
.context("location tasks preparation")?;
|
||||
|
||||
@ -7363,6 +7364,10 @@ impl Editor {
|
||||
.filter_map(|location| location.transpose())
|
||||
.collect::<Result<_>>()
|
||||
.context("location tasks")?;
|
||||
|
||||
let Some(workspace) = workspace else {
|
||||
return Ok(());
|
||||
};
|
||||
workspace
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
Self::open_locations_in_multibuffer(
|
||||
|
@ -394,10 +394,6 @@ pub fn show_link_definition(
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(project) = editor.project.clone() else {
|
||||
return;
|
||||
};
|
||||
|
||||
let same_kind = hovered_link_state.preferred_kind == preferred_kind
|
||||
|| hovered_link_state
|
||||
.links
|
||||
@ -419,6 +415,7 @@ pub fn show_link_definition(
|
||||
} else {
|
||||
editor.hide_hovered_link(cx)
|
||||
}
|
||||
let project = editor.project.clone();
|
||||
|
||||
let snapshot = snapshot.buffer_snapshot.clone();
|
||||
hovered_link_state.task = Some(cx.spawn(|this, mut cx| {
|
||||
@ -436,7 +433,7 @@ pub fn show_link_definition(
|
||||
)
|
||||
})
|
||||
.ok()
|
||||
} else {
|
||||
} else if let Some(project) = project {
|
||||
// query the LSP for definition info
|
||||
project
|
||||
.update(&mut cx, |project, cx| match preferred_kind {
|
||||
@ -468,6 +465,8 @@ pub fn show_link_definition(
|
||||
definition_result.into_iter().map(HoverLink::Text).collect(),
|
||||
)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
TriggerPoint::InlayHint(highlight, lsp_location, server_id) => Some((
|
||||
|
Loading…
Reference in New Issue
Block a user