M1.13: watch open buffers' folders, bufferFocused, truncated tree row

- The parent directory of every open buffer is pinned in the project
  watcher (workspace::sync_buffer_dirs after every command): it counts
  against the cap but is never evicted while a buffer in it is open, so
  reloads and fileChangedOnDisk arrive for never-expanded folders.
- file.open on an already-open buffer emits the new bufferFocused {id};
  the editor activates that tab and it outranks pending adoptions.
- The project tree shows a "Listing truncated" note row
  (project.tree.truncated) after a partly listed directory.
- Tests: engine (pinning, eviction, focus), control channel
  (bufferFocused), Vitest (tab switch, race, truncated row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-16 16:20:11 +02:00
parent 7b7273a947
commit 8a71f7bd08
19 changed files with 312 additions and 30 deletions

View file

@ -89,7 +89,9 @@ impl Engine {
/// event queued so far. When the command fails, events it queued before
/// failing (real changes, such as files saved before another failed) stay
/// queued and arrive with the next successful outcome or
/// [`Engine::take_events`].
/// [`Engine::take_events`]. After every command the parent directories of
/// open buffers are re-pinned in the project watcher
/// ([`crate::workspace::sync_buffer_dirs`]).
///
/// # Errors
/// [`EngineError::UnknownCommand`] for an unknown id,
@ -104,7 +106,9 @@ impl Engine {
if !command.enabled(state) {
return Err(EngineError::Disabled(id.to_string()));
}
command.run(state, params)
let outcome = command.run(state, params);
crate::workspace::sync_buffer_dirs(state);
outcome
});
state.commands_run = state.commands_run.saturating_add(1);
result.map(|mut outcome| {