Repository navigation
Add the rules that decide which editor tabs are the same file (phase 1b-1, unused) - #31272
Conversation
Adds `editorBufferIdentityOf`, not consumed yet: [environment, host, pairing root, path key] with exact case, normalized Windows separators and drive letter, WSL alias folding only for a local Windows client, SSH keyed with its runtime environment, and a detached record id for retired hosts. Splits `resolveEditorModelOwner` out of the owner-key function; the owner key is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
…hase 1b-1 review) - A folded WSL alias is a tagged tuple, so a real `\\wsl\<distro>` share can't collide with it. - `//` is ambiguous between POSIX and UNC, so it folds only for a known-Windows (local) host; drive and `\\` paths still fold separators and the drive letter on any host. - A proven UNC path folds its server name, matching the Monaco URI authority today. - SSH identity includes the target's endpoint incarnation: a target id edited to point at another machine gets a new key, a reconnect keeps it; an unknown endpoint never shares. - Documents the live pairing resolution and per-event retirement ids. Co-Authored-By: Claude <noreply@anthropic.com>
…ified host path flavor - The SSH endpoint is the one the tab captured at open, passed in by the caller; a live lookup would match an old tab to whatever machine the target id names now. Missing means never share. - Remote hosts accept a verified path flavor (`windows` | `posix` | `unknown`), so a Windows host's `//SERVER/share` folds like `\\SERVER\share`, as the Monaco URI authority does today. Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
Later in this series, editor tabs that show the same file in different workspaces will share one record of their unsaved edits. Deciding "is this the same file?" has to be exactly right: if two different files are treated as one, edits from one could be written into the other. This PR adds only that decision, as a small module with thorough tests. Nothing uses it yet, so nothing changes for users.
What Changed
src/renderer/src/store/slices/editor/buffers/editor-buffer-identity.ts: computes the key that will decide which tabs share a buffer record (environment, host, runtime revision, path). Rules:\\), or//paths on a host known to be Windows. On Linux/SSH,//repo/a\b.tsand//repo/a/b.tsstay different files.\\wsl$\…and\\wsl.localhost\…are treated as the same file only on a local Windows client, using a tagged key that can't collide with a real share namedwsl.editor-model-owner.ts: splitsresolveEditorModelOwnerout ofgetEditorModelOwnerKey(pure refactor; output unchanged).Why
This is step 1b-1 of moving to one editor buffer per file. Landing the identity rules first, unused, lets them be reviewed in isolation. Two independent reviews (GPT and Opus) found four ways an earlier draft could merge different files or split files that share today (WSL vs a real
\\wslshare, POSIX//paths, SSH retargeting, UNC server case); all are fixed and covered by tests.A change to the editor model URI for remote files (from draft #30714) was split out of this PR: it is a user-visible fix in its own right (remote
.tsxfiles currently parse as plain TypeScript, and imports can resolve to the local machine's file at the same path) and will come as its own PR.Linked Issue
Follow-up to #31251.
Visual Proof
N/A: no behaviour change; the module is not used yet.
Testing
27 identity tests (exact case, drive letters/separators, WSL folding on Windows only, POSIX
//paths, UNC server case on local and remote Windows hosts, SSH captured endpoint across retarget and reconnect, runtime revision continuation and retirement quarantine).Editor slice and editor-model suites pass (484 tests);
pnpm tc,check:code-quality:changed,oxfmt --check,oxlintclean.Reviewed by GPT (three rounds) and Opus.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The renderer does not yet have each SSH tab's captured endpoint; supplying it is part of the later switch PR. Until then the module would never share SSH tabs.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)