Skip to content

Commit 864d4bc

Browse files
authored
editor: Drop multiline targets in navigation buffers (#36291)
Release Notes: - N/A
1 parent 7784fac commit 864d4bc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

crates/editor/src/editor.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15909,10 +15909,15 @@ impl Editor {
1590915909
.text_for_range(location.range.clone())
1591015910
.collect::<String>()
1591115911
})
15912+
.filter(|text| !text.contains('\n'))
1591215913
.unique()
1591315914
.take(3)
1591415915
.join(", ");
15915-
format!("{tab_kind} for {target}")
15916+
if target.is_empty() {
15917+
tab_kind.to_owned()
15918+
} else {
15919+
format!("{tab_kind} for {target}")
15920+
}
1591615921
})
1591715922
.context("buffer title")?;
1591815923

@@ -16117,10 +16122,15 @@ impl Editor {
1611716122
.text_for_range(location.range.clone())
1611816123
.collect::<String>()
1611916124
})
16125+
.filter(|text| !text.contains('\n'))
1612016126
.unique()
1612116127
.take(3)
1612216128
.join(", ");
16123-
let title = format!("References to {target}");
16129+
let title = if target.is_empty() {
16130+
"References".to_owned()
16131+
} else {
16132+
format!("References to {target}")
16133+
};
1612416134
Self::open_locations_in_multibuffer(
1612516135
workspace,
1612616136
locations,

0 commit comments

Comments
 (0)