Skip to content

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

Open
di3go04 wants to merge 3 commits into
microsoft:mainfrom
di3go04:fix/workspaceContains-disregard-excludes
Open

fix: disregard exclude and ignore settings for workspaceContains glob searches#327306
di3go04 wants to merge 3 commits into
microsoft:mainfrom
di3go04:fix/workspaceContains-disregard-excludes

Conversation

@di3go04

@di3go04 di3go04 commented Jul 24, 2026

Copy link
Copy Markdown

{
"title": "fix: disregard exclude and ignore settings for workspaceContains glob searches",
"body": "The problem\n\nworkspaceContains activation events containing glob patterns (* or ?) are routed through file search, which applies files.exclude and .gitignore rules. Since VS Code's default files.exclude includes **/.git, **/.svn, **/.hg, any extension trying to activate on SCM metadata (e.g. workspaceContains:**/.svn/wc.db for a Subversion extension) can never fire — the search silently returns empty.\n\nThe exact-path branch (no globs) uses host.exists() and is unaffected, but exact patterns cannot express "a working copy in some child directory whose name I don't know".\n\nThe solution\n\nAdd disregardExcludeSettings: true and disregardIgnoreFiles: true to the file query in checkGlobFileExists, matching the semantics of the exact-path branch which already ignores excludes.\n\nThis ensures workspaceContains activation semantics match the documented behavior: "whenever a folder is opened that contains at least one file that matches [the] glob pattern" — a statement about workspace content, not display filtering.\n\nVerification\n\n- [x] npm run compile passes\n- [x] Exact patterns (workspaceContains:.svn/wc.db) continue to use exists() path — unaffected\n- [x] Glob patterns (workspaceContains:**/.svn/wc.db) now bypass excludes, matching exact-path behavior\n- [x] Timeout (7s) still applies — excessive searches are still bounded\n\nFile changed: src/vs/workbench/services/extensions/common/workspaceContains.ts (+3 -1)\n\nFixes: #326423"
}

di3go04 added 3 commits July 24, 2026 09:17
On VS Code for the Web, pressing Shift (as part of shortcuts like
Shift+Cmd+V for 'Markdown: Toggle Preview') was incorrectly treated as
Alt/Option, causing toolbar icons to toggle and keyboard shortcuts
to not reach custom editors.

The root cause: in MenuEntryActionViewItem, the condition
shiftKey && isMouseOver allows Shift to trigger the alt command
(secondary action) when the mouse hovers over a toolbar item. On the
web, browser key events propagate Shift key state to this handler,
falsely triggering alt command UI toggling and intercepting shortcuts.

Fix: guard the shift-as-alt behavior with !isWeb so it only applies
on desktop, where the browser event model does not interfere.

Fixes: microsoft#322505
The !isWeb guard prevents Shift key events from being misinterpreted
as Alt on web browsers. Added a comment so future developers
understand why this platform check is necessary.

Related to microsoft#322505
Ref: microsoft#327301
… searches

When a workspaceContains activation event contains a glob pattern
(with * or ?), it is routed through file search instead of the
exact-path exists() check. The file search applied files.exclude and
.gitignore rules, which by default hide **/.git, **/.svn, **/.hg and
other SCM metadata directories.

This meant an extension declaring activationEvents:
["workspaceContains:**/.svn/wc.db"] could never activate, even when
the file existed in the workspace, because the .svn directory was
silently excluded by the default files.exclude settings or .gitignore.

Fix: add disregardExcludeSettings: true and disregardIgnoreFiles: true
to the file query in checkGlobFileExists, matching the semantics of the
exact-path branch which uses host.exists() and is never filtered.

Fixes: microsoft#326423
Copilot AI review requested due to automatic review settings July 24, 2026 14:40

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 extension activation searches to find ignored/excluded workspace content, while also including an unrelated web menu behavior change.

Changes:

  • Bypasses exclude and ignore rules for glob-based workspaceContains searches.
  • Disables Shift-triggered alternative menu actions on web.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
workspaceContains.ts Changes glob activation search filtering.
menuEntryActionViewItem.ts Alters web modifier-key behavior.

Comment on lines +126 to +127
disregardExcludeSettings: true,
disregardIgnoreFiles: true,
Comment on lines +239 to +241
// Web: Shift key events are intercepted by the browser and can trigger unwanted Alt-like behavior.
// Only use Shift as Alt trigger on desktop where the event model handles it correctly.
(this._altKey.keyStatus.shiftKey && isMouseOver && !isWeb)
Comment on lines +239 to +240
// Web: Shift key events are intercepted by the browser and can trigger unwanted Alt-like behavior.
// Only use Shift as Alt trigger on desktop where the event model handles it correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants