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:
parent
7b7273a947
commit
8a71f7bd08
19 changed files with 312 additions and 30 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* dirty state, notices, and the Save / Don't save / Cancel question when a
|
||||
* dirty tab closes.
|
||||
*
|
||||
* Fed by engine events (`bufferOpened`, `bufferChanged`, `dirtyChanged`,
|
||||
* Fed by engine events (`bufferOpened`, `bufferFocused`, `bufferChanged`, `dirtyChanged`,
|
||||
* `bufferClosed`, `fileChangedOnDisk`, project open/close) and by command
|
||||
* results. Text lives in the engine and in one {@link BufferSync} per tab,
|
||||
* kept outside reactive state. Command failures are stored and shown, never
|
||||
|
|
@ -425,6 +425,18 @@ export const useEditorStore = defineStore("editor", () => {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates the tab of a buffer that `file.open` found already open
|
||||
* (`bufferFocused`). It also outranks adoptions still fetching, so the
|
||||
* most recent open wins.
|
||||
*
|
||||
* @param id - buffer id.
|
||||
*/
|
||||
function focusOpened(id: number): void {
|
||||
++openSequence;
|
||||
activate(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies one editor event.
|
||||
*
|
||||
|
|
@ -439,6 +451,9 @@ export const useEditorStore = defineStore("editor", () => {
|
|||
case "bufferOpened":
|
||||
void adoptOpened(event.id);
|
||||
break;
|
||||
case "bufferFocused":
|
||||
focusOpened(event.id);
|
||||
break;
|
||||
case "bufferChanged":
|
||||
syncs.get(event.id)?.notifyVersion(event.version);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue