Filter panel results by project and hide test code

Roadmap item 3. One Filters button opens a menu holding both, rather than
two more controls in a toolbar that is already crowded in a docked panel:

- Hide test code, with the count of test results.
- A checkbox per project with its result count, plus All / None.

The button shows how many filters are active and the summary line reads
"12 of 43 references" while anything is filtered. Projects are persisted as
an *exclusion* list, so a project that only appears in a later search shows
up instead of being silently hidden. Test hiding seeds from
coloredReferences.hideTests on first results, then follows the panel.

What counts as test code is coloredReferences.testPattern, a regular
expression matched against the workspace-relative path and against the
containing project name. Matching on names turned out to need care: the
first pattern classified Latest.cs as a test because "Latest" contains
"test". The built-in pattern now requires the name to start at a boundary,
or an uppercase T for the CamelCase FooTests.cs form, and covers test/tests
directories, Tests.cs, foo_test.go, test_foo.py, foo.spec.ts and projects
named Something.Tests. An invalid configured regex is reported once and
ignored rather than throwing per search.

These filters narrow the panel only; the editor view still lists everything.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
max
2026-09-07 17:50:02 +02:00
co-authored by Claude Opus 5
parent 3e8ece8ed7
commit 3df78ba490
8 changed files with 468 additions and 6 deletions
+10
View File
@@ -165,6 +165,16 @@
"type": "boolean",
"default": true,
"description": "Use semantic tokens from the language server so identifiers are coloured by what they are. The editor view gets the theme-exact colouring; the panel gets the classification with an approximated palette. Turn off for grammar-only colouring."
},
"coloredReferences.hideTests": {
"type": "boolean",
"default": false,
"description": "Hide references in test code by default. The panel's Filters button toggles it per search."
},
"coloredReferences.testPattern": {
"type": "string",
"default": "",
"markdownDescription": "Regular expression deciding what counts as test code, matched against each result's workspace-relative path and against its containing project name. Leave empty for the built-in pattern, which covers `test`/`tests` directories, `*Tests.cs`, `*_test.go`, `*.spec.ts` and projects named `*.Tests`. Set it to a pattern that matches nothing (for example `$^`) to treat everything as production code."
}
}
},