Skip to content

fix: treat unrecognized @-prefixed text as regular filter in test explorer#307555

Merged
connor4312 merged 1 commit into
microsoft:mainfrom
yogeshwaran-c:fix/test-filter-at-sign-text
Apr 3, 2026
Merged

fix: treat unrecognized @-prefixed text as regular filter in test explorer#307555
connor4312 merged 1 commit into
microsoft:mainfrom
yogeshwaran-c:fix/test-filter-at-sign-text

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When typing text containing @ in the test explorer filter (e.g., @smoke to find a test named "my @smoke test"), the @-prefixed text is consumed by the tag/filter-term regex but doesn't match any known filter term (@failed, @doc, etc.) or tag syntax (@ctrlId:tagId). This causes the text to silently disappear from the glob filter, making it impossible to search for tests with @ in their names.

For example, typing @smoke in the filter produces an empty glob list instead of filtering for tests matching "@smoke".

Closes #159708

What is the new behavior?

Unrecognized @-prefixed text that is neither a known filter term nor a tag is now preserved as regular glob filter text. This means:

  • @smoke → filters for tests matching "@smoke" (previously produced no filter)
  • @smoke @doc hello → filters for "@smoke hello" with the @doc term active (previously only @doc was active)
  • !@smoke → excludes tests matching "@smoke" (previously had no effect)

Known filter terms (@failed, @doc, @executed, @openedFiles, @hidden) and tag syntax (@ctrlId:tagId) continue to work exactly as before.

Additional context

The fix adds tracking variables (isFilterTerm, isTag) to determine whether a regex match was actually consumed as a special filter construct. If not, the loop continues without advancing lastIndex, so the @-prefixed text naturally flows into globText.

Three test cases are added covering the plain, mixed, and negated scenarios.

…lorer

When typing text like "@smoke" in the test explorer filter, the @-prefix
was consumed by the tag regex but did not match any known filter term or
tag syntax. This caused the text to silently disappear from the filter,
making it impossible to search for tests with "@" in their names.

Now, @-prefixed text that is neither a known filter term (@failed, @doc,
etc.) nor a tag (@ctrlId:tagId) is preserved as regular glob filter text.

Closes microsoft#159708
Copy link
Copy Markdown
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good fix, thanks!

@connor4312 connor4312 enabled auto-merge (squash) April 3, 2026 13:19
@connor4312 connor4312 merged commit ffa49fc into microsoft:main Apr 3, 2026
19 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.115.0 milestone Apr 3, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test explorer: allow filtering by text containing "@"

3 participants