Skip to content

feat(picker): support file line navigation - #339

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/file-picker-line-numbers
Aug 24, 2026
Merged

feat(picker): support file line navigation#339
fcoury-oai merged 1 commit into
mainfrom
fcoury/file-picker-line-numbers

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

File-picker queries currently treat a :<line> suffix as part of the filename, so pasting or typing a location such as sona:123 removes the intended file from the results and requires a separate navigation step.

What Changed

  • Parse optional numeric line suffixes only in the file picker, while fuzzy matching, ranking, and highlighting continue to use the filename portion of the query.
  • Open the selected file through the existing location-navigation action, converting one-based input to the editor's zero-based line position while preserving full query history and ordinary file opening.
  • Keep results visible while an incomplete suffix is being typed, handle zero and oversized line numbers safely, and document the syntax in docs/GETTING_STARTED.md.
  • Cover suffix parsing, incremental filtering, filename ranking, highlighting, query history, incomplete suffixes, and real-file navigation in src/ui/file_picker.rs.

How to Test

  1. Open a workspace containing a source_name.rs file with at least 123 lines, press Ctrl-p, and type sona:123. Verify the file remains visible while typing :123; press Enter and confirm the cursor lands on line 123.
  2. Reopen the picker, type sona:, and press Enter. Verify the file still opens normally without a line jump. Repeat with sona:999 for a shorter file and confirm navigation clamps to the final navigable line.
  3. Run cargo test -p red ui::file_picker::tests --lib. The focused suite passes 25 tests; its existing manual performance benchmark remains ignored.

@fcoury-oai
fcoury-oai merged commit 9fcf795 into main Aug 24, 2026
10 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/file-picker-line-numbers branch August 24, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant