editor: Render all targets in go to def multbuffer title (#36167)

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth 2025-08-14 11:11:46 +02:00 committed by GitHub
parent b3d048d6dc
commit ffac8c5128
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15842,19 +15842,23 @@ impl Editor {
let tab_kind = match kind { let tab_kind = match kind {
Some(GotoDefinitionKind::Implementation) => "Implementations", Some(GotoDefinitionKind::Implementation) => "Implementations",
_ => "Definitions", Some(GotoDefinitionKind::Symbol) | None => "Definitions",
Some(GotoDefinitionKind::Declaration) => "Declarations",
Some(GotoDefinitionKind::Type) => "Types",
}; };
let title = editor let title = editor
.update_in(acx, |_, _, cx| { .update_in(acx, |_, _, cx| {
let origin = locations.first().unwrap(); let target = locations
let buffer = origin.buffer.read(cx); .iter()
format!( .map(|location| {
"{} for {}", location
tab_kind, .buffer
buffer .read(cx)
.text_for_range(origin.range.clone()) .text_for_range(location.range.clone())
.collect::<String>() .collect::<String>()
) })
.join(", ");
format!("{tab_kind} for {target}")
}) })
.context("buffer title")?; .context("buffer title")?;
@ -16050,19 +16054,17 @@ impl Editor {
} }
workspace.update_in(cx, |workspace, window, cx| { workspace.update_in(cx, |workspace, window, cx| {
let title = locations let target = locations
.first() .iter()
.as_ref()
.map(|location| { .map(|location| {
let buffer = location.buffer.read(cx); location
format!( .buffer
"References to `{}`", .read(cx)
buffer .text_for_range(location.range.clone())
.text_for_range(location.range.clone()) .collect::<String>()
.collect::<String>()
)
}) })
.unwrap(); .join(", ");
let title = format!("References to {target}");
Self::open_locations_in_multibuffer( Self::open_locations_in_multibuffer(
workspace, workspace,
locations, locations,