Skip to content

fix(picker): prioritize filename matches - #294

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/picker-filename-ranking
Aug 21, 2026
Merged

fcoury-oai merged 1 commit into
mainfrom
fcoury/picker-filename-ranking

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

The buffer picker searches complete paths, so a query like recap matches the shared codex.fcoury-recap directory in every open buffer. That can rank unrelated files such as lib.rs ahead of relevant filenames such as thread_recap.rs.

What changed

  • Extract filename/path scoring, smart-case matching, and Unicode-aware highlights into src/ui/picker_matching.rs.
  • Rank filename matches ahead of directory-only matches in plain and plugin-backed pickers while preserving exact matches, full-path queries, custom ordering, and existing file-picker behavior.
  • Add regressions for shared parent directories, Windows paths, directory-only queries, cross-directory searches, and smart-case queries.

How to Test

  1. Open recap.rs, thread_recap.rs, and lib.rs beneath a shared codex.fcoury-recap directory, run BufferPicker, and search for recap. Expect recap.rs and thread_recap.rs to appear before lib.rs.
  2. Search for a parent-directory name or src/recap; expect directory and full-path matches to remain discoverable. Search for Recap; expect smart-case filtering.
  3. Run cargo test -p red --lib picker; expect all 153 picker tests to pass, including the buffer-picker integration and shared-parent regressions.
  4. Run cargo test -p red --lib and cargo clippy --all-targets --all-features -- -D warnings; expect 2,074 passing library tests, one ignored test, and no Clippy warnings.

@fcoury-oai
fcoury-oai merged commit db6c678 into main Aug 21, 2026
10 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/picker-filename-ranking branch August 21, 2026 20:19
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