Skip to content

fix(neotree): keep large workspaces responsive - #344

Merged
fcoury-oai merged 2 commits into
mainfrom
fcoury/neotree-responsive
Aug 26, 2026
Merged

fcoury-oai merged 2 commits into
mainfrom
fcoury/neotree-responsive

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

Opening Neo-tree could freeze the editor while Git scanned a large worktree. Directory listing already ran in the background, but GetGitStatus waited synchronously for Git before the editor could process input or redraw.

Changes

  • Move repository discovery, cache validation, Git execution, and status indexing off the editor task. Stop Git after 30 seconds or when the request is cancelled, and disable optional index writes.
  • Keep the tree usable while Git loads. Show elapsed time for slow scans and an R retry hint on failure; retain previous decorations but label them stale.
  • Coalesce refresh events into one active Git scan and at most one follow-up. Reject late responses after closing or reopening the panel, and show directory loading/read errors without discarding cached entries.
  • Add CancelGitStatus and the nonselectable SetPanelStatus footer in host API 0.16.0, with documentation and regression coverage.

How to Test

  1. Run cargo build --bin red, then target/debug/red --root ../large-repository, substituting an existing large Git worktree.

  2. Press Ctrl-e. While Git is pending, navigate with j/k or G and expand a directory. The tree should remain responsive, with Git decorations arriving separately.

  3. Press R during a scan, then q and Ctrl-e. Closing should respond immediately, and reopening should not apply results from the cancelled request.

  4. Run the deterministic timeout, stale-status, and cancellation regressions:

    cargo test --lib -- \
      git_status_timeout_and_cancellation_stop_the_child \
      neotree_coalesces_refreshes_and_preserves_stale_status_on_error \
      neotree_discards_late_results_after_close_and_reopen

    These should confirm that the child exits on timeout/cancellation, failed refreshes retain stale decorations and allow retry, and late results cannot repaint a reopened panel.

Validation

  • 157 focused tests passed at 76c7e1c9, covering Neo-tree, Git status, directory listings, panel rendering/navigation, and host API contracts.
  • cargo clippy --all-targets --all-features -- -D warnings, formatting, and diff checks passed.
  • macOS terminal smoke verified browsing through a slow Git scan and timeout, cancellation/reopening, and successful retry in a controlled fixture. Windows and Linux were not smoke-tested.

@fcoury-oai
fcoury-oai merged commit 5862875 into main Aug 26, 2026
14 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/neotree-responsive branch August 26, 2026 17:35
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.

2 participants