Skip to content

Show active search filters as picker badges - #440

Merged
fcoury merged 1 commit into
mainfrom
fcoury/search-toggle-feedback
Nov 7, 2026
Merged

fcoury merged 1 commit into
mainfrom
fcoury/search-toggle-feedback

Conversation

@fcoury

@fcoury fcoury commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Why

Pressing Alt-h, Alt-i or Ctrl-e in Find in Files gave no visible feedback before a query was typed: the status read "Type to search" and the active flags were only appended once there were results. Even then they were one grey word in 2 matches [regex hidden preview], mixed with flags that never matter (regex, preview). The file picker did show hidden ignored after Ctrl-e, but it replaced the result count to do it.

What

Active filters now appear as bold, warning-coloured badges at the start of the footer divider, independent of the status at the end:

├─ +hidden  +ignored ──────────────────────────── 4 matches ┤
  • Badges only mark departures from the defaults: +hidden, +ignored, +symlinks, and literal when regex is off. With default settings the divider stays clean.
  • Find in Files sends badges on open and on every refresh, so toggles show up immediately with an empty query. The status no longer carries the […] flag list.
  • File picker shows +hidden +ignored after Ctrl-e and keeps its 5/5 count.
  • Picker core draws badges on the divider, counts them in the intrinsic width, and drops trailing badges whole when they would reach the status.
  • Plugin API: PickerOptions.badges and UpdatePickerBadges(id, badges), added to the pending host API 0.22.0 with the schema, change manifest and docs/PLUGIN_API.md.

How to Test

  1. In a repo with a hidden directory and a gitignored file, open Find in Files. The divider shows only Type to search.
  2. Press Alt-h, then Alt-i: +hidden, then +hidden +ignored appear before typing anything.
  3. Type a query that matches hidden and ignored files: badges stay, the status shows the match count. Alt-r adds literal; Ctrl-e clears hidden and ignored.
  4. Open the file picker (Ctrl-p) and press Ctrl-e: +hidden +ignored appears on the left with the count still on the right; Ctrl-e again removes it.

Automated: cargo test --lib filter_badges, cargo test --lib project_search, cargo test --lib file_picker.

Find in Files and the file picker now label widened scopes (+hidden,
+ignored, +symlinks, literal) on the footer divider, so toggling them
gives immediate feedback even before a query is typed. Adds
PickerOptions.badges and UpdatePickerBadges to host API 0.22.0.
@fcoury
fcoury merged commit 3c793ea into main Nov 7, 2026
20 checks passed
@fcoury
fcoury deleted the fcoury/search-toggle-feedback branch November 7, 2026 15:17
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