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
+95
View File
@@ -345,3 +345,98 @@ body.resizing {
background: var(--vscode-inputValidation-warningBackground);
border-color: var(--vscode-inputValidation-warningBorder, transparent);
}
/* --- filters popover ---------------------------------------------------- */
.popover-host {
position: relative;
flex: 0 0 auto;
}
.popover {
position: absolute;
top: calc(100% + 4px);
right: 0;
z-index: 10;
min-width: 200px;
max-width: 320px;
max-height: 60vh;
overflow-y: auto;
padding: 4px;
color: var(--vscode-menu-foreground, var(--vscode-foreground));
background: var(--vscode-menu-background, var(--vscode-editorWidget-background));
border: 1px solid var(--vscode-menu-border, var(--vscode-editorWidget-border));
border-radius: 4px;
box-shadow: 0 2px 8px var(--vscode-widget-shadow, rgba(0, 0, 0, 0.36));
}
.popover[hidden] {
display: none;
}
.popover-heading {
padding: 6px 6px 2px;
color: var(--vscode-descriptionForeground);
font-size: 0.9em;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.popover-row {
display: flex;
align-items: center;
gap: 6px;
padding: 3px 6px;
border-radius: 2px;
cursor: pointer;
white-space: nowrap;
}
.popover-row:hover {
background: var(--vscode-list-hoverBackground);
}
.popover-row.disabled {
opacity: 0.5;
}
.popover-row input {
flex: 0 0 auto;
margin: 0;
accent-color: var(--vscode-checkbox-background, var(--vscode-button-background));
}
.popover-label {
flex: 1 1 auto;
overflow: hidden;
text-overflow: ellipsis;
}
.popover-count {
flex: 0 0 auto;
color: var(--vscode-descriptionForeground);
font-variant-numeric: tabular-nums;
}
.popover-actions {
display: flex;
gap: 8px;
padding: 4px 6px 2px;
border-top: 1px solid var(--vscode-menu-separatorBackground, var(--vscode-panel-border));
margin-top: 4px;
}
.link-button {
padding: 0;
color: var(--vscode-textLink-foreground);
background: none;
border: none;
font-family: inherit;
font-size: inherit;
cursor: pointer;
}
.link-button:hover {
color: var(--vscode-textLink-activeForeground);
text-decoration: underline;
}