fix: disregard exclude and ignore settings for workspaceContains glob searches - #327306
Open
di3go04 wants to merge 3 commits into
Open
fix: disregard exclude and ignore settings for workspaceContains glob searches#327306di3go04 wants to merge 3 commits into
di3go04 wants to merge 3 commits into
Conversation
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
Contributor
There was a problem hiding this comment.
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
workspaceContainssearches. - 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
{
"title": "fix: disregard exclude and ignore settings for workspaceContains glob searches",
"body": "The problem\n\n
workspaceContainsactivation events containing glob patterns (*or?) are routed through file search, which appliesfiles.excludeand.gitignorerules. Since VS Code's defaultfiles.excludeincludes**/.git,**/.svn,**/.hg, any extension trying to activate on SCM metadata (e.g.workspaceContains:**/.svn/wc.dbfor a Subversion extension) can never fire — the search silently returns empty.\n\nThe exact-path branch (no globs) useshost.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\nAdddisregardExcludeSettings: trueanddisregardIgnoreFiles: trueto the file query incheckGlobFileExists, matching the semantics of the exact-path branch which already ignores excludes.\n\nThis ensuresworkspaceContainsactivation 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 compilepasses\n- [x] Exact patterns (workspaceContains:.svn/wc.db) continue to useexists()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"}