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:
@@ -11,8 +11,8 @@ highlighted like search matches; **writes are bold** on the theme's stronger wri
|
||||
same colour the editor itself uses for a write.
|
||||
|
||||
**Panel view** shows the same results as a table with resizable, sortable columns — Code, File, Line, Kind,
|
||||
Project and Containing member — grouped by file, with a filter box and a reads/writes filter. By default it
|
||||
docks in the **bottom panel**
|
||||
Project and Containing member — grouped by file, with a text filter plus filters for reads/writes, project and
|
||||
test code. By default it docks in the **bottom panel**
|
||||
alongside Terminal and Problems, where a wide, short table reads best; you can drag it to either side bar,
|
||||
or set `coloredReferences.panelLocation` to put it in an editor group instead.
|
||||
|
||||
@@ -36,6 +36,19 @@ The **All / Reads / Writes** buttons filter by kind, and the summary line counts
|
||||
the text filter, so typing `write` narrows to writes as well. See *Known limitations* for where the kind comes
|
||||
from.
|
||||
|
||||
**Filters** opens a menu to hide test code or to include only some projects, each with its result count. The
|
||||
button shows how many filters are active, and the summary line reads *"12 of 43 references"* while anything is
|
||||
filtered. Choices persist per panel, and projects are remembered as an *exclusion* list — a project that only
|
||||
turns up in a later search shows up rather than being silently hidden.
|
||||
|
||||
What counts as test code is a regular expression, `coloredReferences.testPattern`, matched against each
|
||||
result's workspace-relative path and against its containing project name. The built-in pattern covers
|
||||
`test`/`tests` directories, `FooTests.cs`, `Tests.cs`, `foo_test.go`, `test_foo.py`, `foo.spec.ts` and projects
|
||||
named `Something.Tests` — without catching names that merely contain the word, like `Latest.cs` or a `contest`
|
||||
directory. `coloredReferences.hideTests` sets whether the filter starts on.
|
||||
|
||||
These filters narrow what the panel shows; the editor view always lists every reference.
|
||||
|
||||
## Semantic tokens
|
||||
|
||||
VS Code colors code twice: a TextMate grammar handles keywords, strings and comments from the text alone, then
|
||||
@@ -63,6 +76,9 @@ grammar-only colouring; results spanning more than 40 files skip it.
|
||||
- `coloredReferences.openBeside` — open results beside the current editor (default `true`)
|
||||
- `coloredReferences.showProject` — show the containing project in file headers (default `true`)
|
||||
- `coloredReferences.reuseTab` — reuse one results tab/panel instead of opening a new one per search (default `true`)
|
||||
- `coloredReferences.hideTests` — start the panel with test code hidden (default `false`)
|
||||
- `coloredReferences.testPattern` — regular expression deciding what counts as test code; empty uses the
|
||||
built-in pattern
|
||||
|
||||
## Install
|
||||
|
||||
@@ -107,6 +123,6 @@ the expected results stay deterministic.
|
||||
1. ~~Webview panel with resizable, sortable columns~~ — done; missing: virtualized rendering for very large
|
||||
result sets, and remembering column layout per workspace rather than per panel
|
||||
2. ~~Semantic token overlay~~ — done in both views
|
||||
3. Filter by project / exclude tests
|
||||
3. ~~Filter by project / exclude tests~~ — done in the panel
|
||||
4. ~~Read/write kind~~ — done in both views
|
||||
|
||||
|
||||
Reference in New Issue
Block a user