Repository navigation
fix(#112): rewrite file import paths on Explorer rename (+ recovery) - #286
Open
projectcarbonfiber wants to merge 1 commit into
Open
projectcarbonfiber wants to merge 1 commit into
projectcarbonfiber wants to merge 1 commit into
Conversation
Keep source: { type: file } paths valid when .flyde (or code) files move
in the VS Code explorer via onWillRenameFiles + scalar-only YAML edits in
@flyde/loader. Also recover stale paths at resolve time when a file was
moved outside the IDE.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #112
/claim #112
Summary
When a
.flyde(or code) file that is imported viasource: { type: file }is moved in the VS Code Explorer, the importer’s stored relative path went stale and resolution failed (join(flowDir, stored)).This PR keeps imports working with a dual path:
onWillRenameFiles+WorkspaceEditrewrites only thedatascalars ofsource: { type: file }entries (including nested inline visuals). Pure path math lives in@flyde/loader(getReferenceEditsForRename) so the VS Code adapter stays thin. Edits apply at the old URI before the rename, which plays well with dirty buffers / undo.recoverMovedFileSourcesearches the project for the same basename (skippingnode_modules/.git/ build dirs) and prefers the best path-suffix match.Package and custom sources are left untouched. Absolute refs, Windows paths, batch/folder renames, and most-specific overlapping maps are covered by hermetic tests.
Acceptance criteria
.flyde/.flyde.ts) updates importers’ relative pathssource.fileentries updateonWillRenameFiles+ open document text)Test plan / results
Loader (hermetic), run from
loader/:Result: 26 passing (21 rename-reference cases + 5 recovery cases), covering producer/consumer/folder/batch/prefix-safety/simultaneous/most-specific/package-skip/inline/CRLF/aliases/absolute/Windows/cross-drive/invalid YAML/block scalars/anchors + recovery happy/moved/collision/null/
node_modulesskip.VS Code contract suite added at
vscode/src/test/suite/renameReferences.test.ts(unsaved docs, consumer rebase, malformed skip, authority filter, mid-scan version bump,waitUntilregistration). Full extension host run not executed in this environment (pre-existing@flyde/editorbuild deps); logic under test is the same pure helper covered above.Notes
Several open PRs already explore Explorer rewrite; this submission focuses on a clean loader-owned rewrite API plus an explicit recovery fallback for moves that never went through VS Code. Happy to adjust scope if maintainers prefer rewrite-only.