Skip to content

fix: disregard exclude and ignore settings for workspaceContains glob searches - #327347

Open
di3go04 wants to merge 1 commit into
microsoft:mainfrom
di3go04:fix/workspaceContains-disregard-excludes-clean
Open

fix: disregard exclude and ignore settings for workspaceContains glob searches#327347
di3go04 wants to merge 1 commit into
microsoft:mainfrom
di3go04:fix/workspaceContains-disregard-excludes-clean

Conversation

@di3go04

@di3go04 di3go04 commented Jul 24, 2026

Copy link
Copy Markdown

Problem

workspaceContains activation events with glob patterns (*, ?) are routed through file search in checkGlobFileExists. That search applies files.exclude defaults (**/.git, **/.svn, **/.hg), so an extension declaring "activationEvents": ["workspaceContains:**/.svn/wc.db"] can never activate — even when the file exists — because .svn/ is excluded by default.

Exact patterns (no glob) use host.exists() which never consults excludes and work correctly. Only the glob search path is affected.

Solution

Add disregardExcludeSettings: true and disregardIgnoreFiles: true to the file search query in checkGlobFileExists. This tells the search engine to ignore both files.exclude and search ignore files, matching the semantics of the exact-path branch.

Verification

  • Compiled cleanly (npm run compile) — no errors.
  • The existing exact-path branch is unchanged and continues to use host.exists().
  • The fix is minimal (2 lines added).

Fixes: #326423

Copilot AI review requested due to automatic review settings July 24, 2026 18:05

@kvnsosa kvnsosa left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test review bypass

@kvnsosa kvnsosa left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates glob-based workspace detection to ignore file exclusions and ignore files.

Changes:

  • Disregards exclude settings during glob searches.
  • Disregards ignore files during glob searches.

Comment on lines +126 to +127
disregardExcludeSettings: true,
disregardIgnoreFiles: true,
- Add shouldIgnoreExcludesForPattern() to detect if a glob explicitly
  targets directories like .git, .svn, .hg, or node_modules.
- Only apply disregardExcludeSettings and disregardIgnoreFiles when
  the pattern matches these directories.
- Preserve performance for broad patterns like **/*.ts by continuing
  to respect files.exclude.

Related to microsoft#326423
Ref: microsoft#327347
@di3go04
di3go04 force-pushed the fix/workspaceContains-disregard-excludes-clean branch from 28ae99a to 8a06172 Compare July 24, 2026 18:14
@di3go04

di3go04 commented Jul 24, 2026

Copy link
Copy Markdown
Author

I've refined the solution based on the performance concern raised by Copilot.

Now, disregardExcludeSettings and disregardIgnoreFiles are only applied when the glob pattern explicitly targets commonly-excluded directories:

  • .git, .svn, .hg, node_modules

This ensures:

  • Extensions targeting SCM metadata (e.g., **/.svn/wc.db) can activate.
  • Broad patterns (e.g., **/*.ts) continue to respect files.exclude, preserving startup performance.

Please review again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants