Repository navigation
fix(vscode): keep .flyde imports working after files are moved - #288
Closed
ntoledo319 wants to merge 1 commit into
Closed
ntoledo319 wants to merge 1 commit into
ntoledo319 wants to merge 1 commit into
Conversation
Flow files reference imported nodes through workspace-relative paths in each instance's source.data, so moving an imported .flyde file to another folder broke the import (flydelabs#112). The extension now listens to workspace file rename events and rewrites the affected references in every .flyde file: - when an imported file moves, references resolving to its old path are re-pointed at the new path - when a flow file itself moves, its relative file imports are re-relativized against the new location The rewriting logic lives in @flyde/loader (updateFlydeImportsAfterMove) and edits the YAML document AST so unrelated formatting is preserved. The extension also activates on workspaces containing .flyde files so moves are handled even before a flow editor is opened. Built with AI coding assistance under human direction.
Author
|
Withdrawing for now to keep the review queue light — happy to reopen if the fix approach is wanted. |
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.
Summary
Fixes #112
/claim #112
Flow files reference imported nodes via workspace-relative paths in each instance's
source.data. When an imported.flydefile was moved to another folder, the stored relative path no longer resolved and the import broke.What changed
@flyde/loader— newupdateFlydeImportsAfterMove()(loader/src/resolver/server/updateMovedFlydeImports.ts): given a flow's contents and a file move (old path → new path), it rewrites the affectedsource.datareferences. Edits go through the YAML document AST, so unrelated formatting/content is preserved. Returnsnullwhen nothing needs updating.flyde-vscode— newvscode.workspace.onDidRenameFileslistener (vscode/src/update-imports-on-rename.ts) that applies the rewrite to every.flydefile in the workspace after files are moved/renamed. It handles both directions:workspaceContains:**/*.flydeso moves are handled even before a flow editor is opened.Verification
loader/src/resolver/server/updateMovedFlydeImports.spec.ts— all passing (imported-file move, importing-flow move, both moved together, unrelated move, package sources untouched,.flyde.tscode imports, formatting preservation, unparseable flow).pnpm buildpasses (typechecks loader + extension).eslintclean on changed extension files.nested-flowsfixtures: reproduced the breakage after movingChildFlow.flyde, applied the rewrite (./ChildFlow.flyde→./nested/ChildFlow.flyde), and the flow resolves again.Demo
Known limitation
If a flow affected by a move is currently open in the Flyde editor with unsaved changes, a later save from the webview could overwrite the rewritten import. Handling that requires editor-state coordination beyond this focused fix.
Built with AI coding assistance (Kimi Code) under human direction; the diff was reviewed and verified locally before submitting.