file_finder: Fix `path:line` navigation when target file is already open (#55875)
Three pieces of state combined to break `path:line` queries when the
target file was already open:
- The `CreateNew` lookup ran against `query.raw_query.as_str()`, so a
path with a row suffix never matched the existing file and a stray
`Create file: foo.rs:3` row was always pushed.
- `calculate_selected_index` applied `skip_focus_for_active_in_search`
even when the query carried a row/column, jumping past the file the user
was asking to navigate inside.
- The preserved-selection path only invalidated on `path_query()`
changes. Appending `:3` to a typed-out path therefore kept the
previously skipped-to fuzzy neighbor selected, hiding the fix above when
the query was built up character by character.
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable
Closes #55551
Release Notes:
- Fixed File Finder offering to create a file instead of navigating to a
line when the target file is already open
9dc8880b2bKunall Banerjee committed on 7/30/2026, 7:48:30 PM· committed by GitHubparent998fbf3