Search "Files to Include" behaves incorrectly when workspace root and nested file patterns are specified together

Open
#323,391 0 comments 0 reactions 1 assignee View on GitHub

@osortega is already working on this.

Since Jun 29, 2026.

Assessment

This issue has not been assessed yet.

Description

When a workspace root pattern and nested file patterns are specified together in files to include, the search scope is narrowed to the more specific patterns.

For example, searching with ./ searches the entire workspace.
However, searching with ./, ./folder/file searches only ./folder/file.

This may be considered an unusual pattern combination, but when include patterns are generated programmatically by an extension, the current behavior requires manual deduplication.

Also, semantically, adding an include pattern should not reduce the search scope. In this case, adding a pattern that is already contained within another include pattern changes the search results.

The issue appears to be specific to workspace root patterns. Similar combinations using ordinary folder paths work as expected (2.c vs 2.d test).

Reproduction tests for the attached zip file.

  1. Open singleFolderProject and search for content
    a) ./ works correctly
    b) ./, ./folder1/file_1_1.txt (or , ./folder1/file_1_1.txt) incorrectly narrows the search scope
    c) ./folder1, ./folder1/file_1_1.txt works correctly

  2. Open multiRootProject/workspace.code-workspace to test in multi-root workspace
    a) ./ works correctly
    b) ./, ./wsFolder1/folder1 incorrectly narrows the search scope
    c) ./wsFolder1, ./wsFolder1/folder1/wsf1_1.txt incorrectly narrows the search scope
    d) ./wsFolder1/folder1, ./wsFolder1/folder1/wsf1_1.txt works correctly

vscode.find.issue.rootIgnore.zip

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.