Skip to content

feat: support negated terms in the file search - #165

Open
rod-stuchi wants to merge 1 commit into
dlvhdr:mainfrom
rod-stuchi:feat/negative-filter-file
Open

rod-stuchi wants to merge 1 commit into
dlvhdr:mainfrom
rod-stuchi:feat/negative-filter-file

Conversation

@rod-stuchi

@rod-stuchi rod-stuchi commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

The t file search now splits the query into space-separated terms that must all match (case-insensitive substrings). A term prefixed with ! excludes files containing it, e.g. !test or ui !test.

  • a lone ! is ignored, so the results don't empty out while typing the term
  • no regex, matching stays substring-based like before
  • the syntax is documented in the help (t: "search files (!term to exclude)"); the search placeholder is unchanged

Related: #164 (sticky filter) refactors the same matching loop. Once both are in, the sticky filter's filesMatching should use matchesQuery so !term works there too. Whichever lands second needs a small rebase.

How Did You Test this Change?

  • TestMatchesQuery (table-driven: empty query, include, exclude, mixed terms, case-insensitivity, lone !, extra spaces) and TestSearchResultsExcludeNegatedTerms against examples/multiple_files.diff
  • go test ./... and golangci-lint v2.12.2 (0 issues)
  • Manually with go run . < examples/gh_dash_pr.diff: !keys hides ui/keys/branchKeys.go, and ui !section combines an include with an exclude as expected

AI Usage

Built with Claude Code (Claude Opus 5.5). I chose the design (substring only, space-separated AND terms, ! to negate); Claude wrote matchesQuery and the tests, I reviewed the diff, moved the syntax hint from the placeholder to the help text, and tested it manually.

Images/Videos

screenshot 2026-11-05T16 03 34 screenshot 2026-11-05T16 01 17

The `t` file search now splits the query into space-separated terms that
must all match (case-insensitive substrings). A term prefixed with `!`
excludes files containing it, e.g. `ui !test`.
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.

[feature-request] sticky and negated file filters

1 participant