You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
findFiles doesn't find newly added files in a virtual workspace #249197
Does this issue occur when all extensions are disabled?: Yes
This only seems to happen with a virtual workspace like GitHub in vscode.dev
Version: 1.101.0-insider
Commit: 2d6afddc470bf44f7e60fb5b6e6fdd08e771409b
Date: 2025-05-16T17:06:18.089Z
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Add a new file by in the Explorer view (e.g. test.css)
Hit Cmd-P and search for it (type e.g. test)
It does find the file as "recently openend": click the cross to "Remove from Recently Opened"
Hit Cmd-P again to search for the file
Expected: it finds the file
Actual: it doesn't find the file
You may say this is a low-priority bug, because who clears the recently opened files? But I have the same problem when developing my extension, which calls vscode.workspace.findFiles, and there I don't have any recently opened files to fall back on. (I tried using vscode.workspace.findFiles2, but couldn't get it to work in vscode.dev, as it always says "You MUST start in extension development mode".)
Perhaps Andrea Mah (@andreamah) could comment on whether this will be fixed in findFiles2? Or should I start working on a workaround for my extension? Thanks!
Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats, .gif files are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.
If the issue depends on keyboard input, you can help us by enabling screencast mode for the recording (Developer: Toggle Screencast Mode in the command palette). Lastly, please attach this file via the GitHub web interface as emailed responses will strip files out from the issue.
Indeed, the exact steps I reported above now seem to work on insiders.vscode.dev, yet I can still reproduce them on vscode.dev and github.dev (see screen recording). Do you know what changed?
However, also on insiders.vscode.dev the following steps still are not working:
new step: Prime some cache: Hit Cmd-P and search for it (type test)
Add a new file by in the Explorer view (e.g. test.css)
Hit Cmd-P and search for it (type test)
It does find the file as "recently openend": click the cross to "Remove from Recently Opened"
Hit Cmd-P again to search for the file
This was on Version: 1.101.0-insider, Commit: 80203985a911729401181d4c044346508a175f35
Note that I can reproduce this also with this dummy extension (replacing the search in the GUI with a call to findFiles), so the bug must be somewhere in that function (or more accurately some state it depends on).
Note that this.fileSearchCache.get(u) is a cache hit but does not include the new files. Thus the bug must be in whatever fails to update/invalidate the fileSearchCache.
Edit: on second thought, perhaps the github-browser extension is just used the wrong way? fileSearchCache is only set if there was no cache-hit, and only cleared in onRefreshOrRepositoryChanged (exposed as onDidChangeRepository I think). Otherwise it doesn't change. So probably the bug is that onDidChangeRepository is not called in that case.
I'm experiencing a similar issue where vscode.workspace.findFiles returns empty results in virtual workspaces, even when files exist and are accessible via direct vscode.workspace.fs.stat calls.
My specific case
Extension: VS Code pnpm Workspace
Problem: Need to find package.json files using patterns like packages/*/package.json
Workspace types affected: GitHub Codespaces, vscode-test-web://, and other non-file scheme workspaces
Standard findFiles returns 0 results despite files being present and accessible
Workaround implemented
I've created a comprehensive fallback system that manually traverses directories using vscode.workspace.fs APIs when findFiles fails in virtual workspaces. The implementation includes:
Detection of virtual workspaces (non-file URI schemes)
Manual directory traversal with glob pattern matching
Fallback chain: try findFiles first, then manual traversal if needed
This issue significantly affects extension functionality in virtual workspaces, requiring complex workarounds that duplicate VS Code's built-in file discovery logic. A fix would eliminate the need for these manual implementations and improve the developer experience for extensions that rely on file discovery.
The workaround works reliably, but it would be much better to have the standard findFiles API work consistently across all workspace types.
Activity
mb21 commentedon May 23, 2025
Perhaps Andrea Mah (@andreamah) could comment on whether this will be fixed in
findFiles2? Or should I start working on a workaround for my extension? Thanks!andreamah commentedon May 23, 2025
I don't work in this area anymore, so I'll defer to Osvaldo Ortega (@osortega) :)
extension: add poor findFiles replacement
osortega commentedon May 29, 2025
Mauro Bieg (@mb21) I'm unable to reproduce this issue, looks like even after removing from recently opened I still see the file.

/gifPlease
vs-code-engineering commentedon May 29, 2025
Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats,
.giffiles are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.If the issue depends on keyboard input, you can help us by enabling screencast mode for the recording (
Developer: Toggle Screencast Modein the command palette). Lastly, please attach this file via the GitHub web interface as emailed responses will strip files out from the issue.Happy coding!
mb21 commentedon Jun 2, 2025
Indeed, the exact steps I reported above now seem to work on insiders.vscode.dev, yet I can still reproduce them on vscode.dev and github.dev (see screen recording). Do you know what changed?
However, also on insiders.vscode.dev the following steps still are not working:
Cmd-Pand search for it (typetest)test.css)Cmd-Pand search for it (typetest)Cmd-Pagain to search for the fileThis was on
Version: 1.101.0-insider, Commit: 80203985a911729401181d4c044346508a175f35Note that I can reproduce this also with this dummy extension (replacing the search in the GUI with a call to
findFiles), so the bug must be somewhere in that function (or more accurately some state it depends on).mb21 commentedon Jun 3, 2025
Osvaldo Ortega (@osortega) do I need to do anything for the
info-neededtag to go away?mb21 commentedon Jun 4, 2025
Okay, I debugged this with the Chrome dev tools on insiders.vscode.dev commit
7197360b79e6da3404ed5ad1fb4d7ea74a8bb5d2:The return value of this.provider.provideFileSearchResults does not include the new files.
After that it calls into this extension.js file that has no source maps (or at least they don't load for me), and calls the function:
Note that
this.fileSearchCache.get(u)is a cache hit but does not include the new files. Thus the bug must be in whatever fails to update/invalidate thefileSearchCache.I searched for the source of this file, and found
extensions/github-browser/src/github/fs.tsin an old version of vscode, which looks very much like that file. However, it seems thatextensions/github-browserwas moved somewhere else a while ago, probably a private repo?Osvaldo Ortega (@osortega) or Andrea Mah (@andreamah) Would be great if you could tell me who owns that code now, because that's where the bug is. Seems this is the feedback repo?
Edit: on second thought, perhaps the
github-browserextension is just used the wrong way?fileSearchCacheis onlysetif there was no cache-hit, and onlycleared inonRefreshOrRepositoryChanged(exposed asonDidChangeRepositoryI think). Otherwise it doesn't change. So probably the bug is thatonDidChangeRepositoryis not called in that case.osortega commentedon Jun 9, 2025
Thanks for all the details, this helps a lot. I was able to reproduce this bug and marked it as confirmed
lennondotw commentedon Jul 23, 2025
I'm experiencing a similar issue where
vscode.workspace.findFilesreturns empty results in virtual workspaces, even when files exist and are accessible via directvscode.workspace.fs.statcalls.My specific case
packages/*/package.jsonvscode-test-web://, and other non-file scheme workspacesfindFilesreturns 0 results despite files being present and accessibleWorkaround implemented
I've created a comprehensive fallback system that manually traverses directories using
vscode.workspace.fsAPIs when findFiles fails in virtual workspaces. The implementation includes:You can see the full implementation here:
https://github.com/reekystive/vscode-pnpm-workspace/blob/3d8b2ea3e46913ae2a47df4b530725898ec5b72c/src/virtual-workspace-workaround.ts#L146
Impact
This issue significantly affects extension functionality in virtual workspaces, requiring complex workarounds that duplicate VS Code's built-in file discovery logic. A fix would eliminate the need for these manual implementations and improve the developer experience for extensions that rely on file discovery.
The workaround works reliably, but it would be much better to have the standard findFiles API work consistently across all workspace types.
mjbvz commentedon Nov 18, 2025
This also is effecting
#codebase. Simple repo:MemFS: setup workspacethenMemFS: Create filesto populate itvscode.workspace.findFiles('**/*');This call never returns in my testing