Skip to content

Explorer does not refresh when previously removed root is coming back #134144

Closed

Description

@TylerLeonhardt

Testing #133753

macOS. I have a VS Code window open to the vscode repo but it does NOT have focus. I instead have focus on another window of VS Code (or another app... same behavior)

Here's the script I'm running outside of VS Code:

All it does is renames the vscode folder that I have open in VS Code and renames it back 100 times.

1..100 | % {
    mv ./vscode ./vscode-olddd
    sleep 10
    mv ./vscode-olddd ./vscode
    sleep 10
}

I noticed that the removal of the vscode folder gets reflected in the VS Code instance with the vscode repo (where it gives you the ! that says this folder doesnt exist)

However, when the rename gets changed back to vscode thus "recreating" the vscode folder, nothing is reflected in the VS Code instance with the vscode repo.

However, once I focus the VS Code instance with the vscode repo then the contents are refreshed and it shows up and everything is fine.

Activity

  1. TylerLeonhardt commented on Sep 29, 2021

    @TylerLeonhardt
    MemberAuthor

    This same behavior happens when you rename the target of a symbolic link and then rename it back.

  2. bpasero commented on Sep 30, 2021

    @bpasero
    Contributor

    Yeah I noticed this as well and wonder if this is an issue in the explorer itself because doing the same (mv folderNameA folderNameB) is nicely reflected in the explorer for children of the root.

    We must be having some handling of change events for folders, but probably not for the root itself? I think if the root changes we should do a refresh of the tree, but probably only in this case where we had a deleted root before because we do not really want the entire tree to refresh in other cases for performance reasons.

  3. changed the title [-]Re-adding folder doesn't get reflected in VS Code until focus[/-] [+]Explorer does not refresh when previously removed root is coming back[/+] on Sep 30, 2021
  4. added
    bug
    on Sep 30, 2021
  5. added
    unreleased
    on Oct 13, 2026
  6. added
    insiders-released
    and removed
    unreleased
    on Oct 14, 2026
  7. federicobrancasi commented on Oct 18, 2026

    @federicobrancasi
    Member

    🤖 How to verify: the video for this fix is in this comment, with related fixes. It walks through the steps in real VS Code Insiders, checking each result in the app.

  8. mrleemurray commented on Oct 19, 2026

    @mrleemurray
    Contributor

    Verification: ordinary root passes; symlinked root still fails

    Tested VS Code Insiders 1.143.0, commit 341e0fa9346520e7a6a09803a80c5ecd3027f3cb, on macOS 26.7.1 / Apple Silicon. Confirmed this build contains #341323.

    Ordinary workspace root: passed

    Ran three external rename-away/restore cycles, keeping the root missing for 10 seconds and restored for 10 seconds each time. The test window remained unfocused throughout, with no manual refresh or collapse/expand actions.

    • Renaming the root away removed its contents and displayed the missing-root ! decoration.
    • Restoring the root automatically cleared the decoration and restored its contents in 5.47–5.52 seconds.
    • A fresh marker file created during each missing-root interval appeared after restoration, confirming a real refresh rather than stale contents.

    Symlinked single-folder workspace root: still fails

    Also tested the symlink-target case mentioned above, using a directory symlink as the workspace root:

    1. Open the symlinked root and confirm its original file is visible.
    2. Move focus to another application.
    3. Externally rename the symlink target away; leave the symlink itself unchanged.
    4. Create a fresh marker file inside the renamed target, then rename the target back to its original path.
    5. Observe Explorer without refocusing or manually refreshing it.

    Observed: Explorer becomes empty when the target is renamed away, without the expected missing-root ! decoration. After restoring the target, Explorer remains empty for at least 30 seconds, with neither the original file nor the new marker visible. This background restoration failure reproduced in two independent runs. In an additional diagnostic, intentional native refocus succeeded, but Explorer still remained empty for another 10 seconds.

    Focus was checked using document.hasFocus() plus window-focus event monitoring. These runs used a native Electron launch and a CDP connection with Playwright default focus emulation disabled; no unexpected focus events occurred during the background checks.

    Automated regression coverage

    ./scripts/test.sh --run src/vs/workbench/contrib/files/test/browser/explorerService.test.ts --grep 'Files - ExplorerService' --reporter dot

    Result: 35 passing, including the root-restoration and focus-related tests.

    Conclusion: the ordinary-root fix verifies, but I would not mark the entire issue verified because the symlinked-root case remains broken.

    Scope: three ordinary-root cycles, not the original 100-cycle stress loop. Linux, Windows, and a pre-fix product comparison were not tested. Screenshots/video were captured locally but are not attached to this comment.

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

Metadata

Metadata

Labels

bugfile-explorerinsiders-releasedverification-found

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions