Editor: tweak label for "Go to implementation" tabs (#8201)
No release notes as this is a followup to #7890 Release Notes: - N/A
This commit is contained in:
parent
20b10fdca9
commit
fa2c92d190
2 changed files with 11 additions and 4 deletions
|
@ -7409,6 +7409,7 @@ impl Editor {
|
||||||
let definitions = definitions.await?;
|
let definitions = definitions.await?;
|
||||||
editor.update(&mut cx, |editor, cx| {
|
editor.update(&mut cx, |editor, cx| {
|
||||||
editor.navigate_to_hover_links(
|
editor.navigate_to_hover_links(
|
||||||
|
Some(kind),
|
||||||
definitions.into_iter().map(HoverLink::Text).collect(),
|
definitions.into_iter().map(HoverLink::Text).collect(),
|
||||||
split,
|
split,
|
||||||
cx,
|
cx,
|
||||||
|
@ -7441,8 +7442,9 @@ impl Editor {
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn navigate_to_hover_links(
|
pub(crate) fn navigate_to_hover_links(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
kind: Option<GotoDefinitionKind>,
|
||||||
mut definitions: Vec<HoverLink>,
|
mut definitions: Vec<HoverLink>,
|
||||||
split: bool,
|
split: bool,
|
||||||
cx: &mut ViewContext<Editor>,
|
cx: &mut ViewContext<Editor>,
|
||||||
|
@ -7511,13 +7513,18 @@ impl Editor {
|
||||||
cx.spawn(|editor, mut cx| async move {
|
cx.spawn(|editor, mut cx| async move {
|
||||||
let (title, location_tasks, workspace) = editor
|
let (title, location_tasks, workspace) = editor
|
||||||
.update(&mut cx, |editor, cx| {
|
.update(&mut cx, |editor, cx| {
|
||||||
|
let tab_kind = match kind {
|
||||||
|
Some(GotoDefinitionKind::Implementation) => "Implementations",
|
||||||
|
_ => "Definitions",
|
||||||
|
};
|
||||||
let title = definitions
|
let title = definitions
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|definition| match definition {
|
.find_map(|definition| match definition {
|
||||||
HoverLink::Text(link) => link.origin.as_ref().map(|origin| {
|
HoverLink::Text(link) => link.origin.as_ref().map(|origin| {
|
||||||
let buffer = origin.buffer.read(cx);
|
let buffer = origin.buffer.read(cx);
|
||||||
format!(
|
format!(
|
||||||
"Definitions for {}",
|
"{} for {}",
|
||||||
|
tab_kind,
|
||||||
buffer
|
buffer
|
||||||
.text_for_range(origin.range.clone())
|
.text_for_range(origin.range.clone())
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
|
@ -7526,7 +7533,7 @@ impl Editor {
|
||||||
HoverLink::InlayHint(_, _) => None,
|
HoverLink::InlayHint(_, _) => None,
|
||||||
HoverLink::Url(_) => None,
|
HoverLink::Url(_) => None,
|
||||||
})
|
})
|
||||||
.unwrap_or("Definitions".to_string());
|
.unwrap_or(tab_kind.to_string());
|
||||||
let location_tasks = definitions
|
let location_tasks = definitions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|definition| match definition {
|
.map(|definition| match definition {
|
||||||
|
|
|
@ -138,7 +138,7 @@ impl Editor {
|
||||||
cx.focus(&self.focus_handle);
|
cx.focus(&self.focus_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.navigate_to_hover_links(hovered_link_state.links, modifiers.alt, cx);
|
self.navigate_to_hover_links(None, hovered_link_state.links, modifiers.alt, cx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue