From 1148773d496eedb58d45ac8acd6472d0bcc549bf Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Date: Tue, 13 Jan 2026 03:33:39 +0900 Subject: [PATCH] project_symbols: Display line numbers in symbol picker (#46507) Some language servers return local symbols in `workspace/symbol` responses, and languages like Julia can have multiple overloads for the same generic function name. In these cases, symbols may appear identical in the symbol picker, making it hard to distinguish between them. Adding line numbers helps users identify the correct symbol. In the future, we may also want to consider using `containerName` from the LSP response for additional context. > Before Screenshot 2026-01-10 at 19 21 08 > After Screenshot 2026-01-10 at 19 43 19 Closes #ISSUE Release Notes: - Added line numbers to the project symbols picker to help distinguish between symbols with the same name --------- Co-authored-by: Matt Miller --- crates/project_symbols/src/project_symbols.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 2031f22ad8a7e655e040b6672ac9b05fd60dc2c8..002bf3a4f78a30623570423e7a83ddf67f750971 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -254,7 +254,8 @@ impl PickerDelegate for ProjectSymbolsDelegate { } => abs_path.to_string_lossy(), }; let label = symbol.label.text.clone(); - let path = path.to_string(); + let line_number = symbol.range.start.0.row + 1; + let path = path.into_owned(); let settings = ThemeSettings::get_global(cx); @@ -290,7 +291,15 @@ impl PickerDelegate for ProjectSymbolsDelegate { .child(LabelLike::new().child( StyledText::new(label).with_default_highlights(&text_style, highlights), )) - .child(Label::new(path).size(LabelSize::Small).color(Color::Muted)), + .child( + h_flex() + .child(Label::new(path).size(LabelSize::Small).color(Color::Muted)) + .child( + Label::new(format!(":{}", line_number)) + .size(LabelSize::Small) + .color(Color::Placeholder), + ), + ), ), ) }