Skip to content

The Explorer notices new, removed and renamed files by itself #334

Description

@a-team-app

Context

With Refresh explorer in place, this slice makes the Explorer keep itself up to date: each expanded folder is watched, and when entries appear, disappear or are renamed in it, that folder refreshes by itself after a short settling delay, the same way open tabs already notice disk changes. Pitch: #292. Needs #332 merged first: it reuses that task's refresh, which keeps expansion and selection.

Acceptance criteria

  • With a folder expanded, creating a file in it from another terminal makes it appear in the tree within about a second, with no keypress.
  • Deleting or renaming a file in an expanded folder from outside updates the tree the same way.
  • git switch to a branch that adds and removes files in expanded folders leaves the tree matching the new branch, without flicker or a visible storm of redraws.
  • Changes inside a collapsed folder don't change anything visible; expanding it later shows its current contents.
  • After an automatic refresh, expanded folders stay expanded and the selection stays on the same file, or moves to its neighbour if that file was removed. The tree only scrolls if it has to.
  • Typing, moving the selection or editing while files change outside doesn't lose keystrokes or jump the cursor.
  • With more than 64 folders expanded, the Explorer still works and Refresh explorer still refreshes all of them.
  • If a folder can't be watched (for example, no permission), nothing breaks and Refresh explorer still works for it.

Tests

  • One non-recursive watcher per expanded folder; collapsing a folder, or removing it, disposes its watcher; closing the workspace disposes all.
  • A burst of events for one folder produces one refresh (debounced as DiskWatcher does); events for different folders refresh each.
  • Cap of 64 watchers: past it the most recently expanded folders are watched and the oldest released.
  • A watcher that fails to start, or errors later, is logged and dropped without throwing.
  • Refreshes are marshalled onto the UI thread.

Out of scope

  • Recursive watching of the workspace, or watching collapsed folders.
  • Settings for excludes, polling, or the cap.
  • Any change to how open tabs react to disk changes.
  • Git status in the tree.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-team:devClaimed by the a-team Dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions