Summary
Fixes #112 — broken imports after moving files.
/claim #112
When a .flyde or .flyde.ts file is moved or renamed in VS Code, all .flyde files that reference it via source.type: "file" now have their relative paths automatically updated to point to the new location.
Problem
When a user creates a flow that imports another .flyde file (e.g., ./ChildFlow.flyde) and then moves that imported file to a different folder, the import path breaks because the relative path stored in source.data is no longer valid.
Solution
Added a workspace.onDidRenameFiles handler in the VS Code extension (updateImportsOnFileMove.ts) that intercepts file move/rename events and automatically updates import paths in all affected .flyde files.
Three scenarios handled:
-
Imported file is moved — All .flyde files referencing the moved file get their source.data paths recalculated relative to the new location.
-
Flow file itself is moved to a different directory — Its internal source.type: "file" references are recalculated relative to the new directory.
-
Both files move simultaneously — The handler cross-references the rename list so paths resolve correctly even when multiple related files are moved at once.
Implementation details:
- Listens to
workspace.onDidRenameFiles (fires after the move completes)
- Only processes moves of
.flyde and .flyde.ts files
- Parses affected flows with the
yaml library (already a dependency via @flyde/loader)
- Handles inline visual nodes recursively
- Uses POSIX-style relative paths (e.g.,
./subfolder/Child.flyde) matching the existing convention
- Shows an info message when paths are updated so the user knows what changed
Files changed
vscode/src/updateImportsOnFileMove.ts — New file with the import update logic
vscode/src/extension.ts — Registers the handler on extension activation
Test plan
- Create
Parent.flyde that imports ./Child.flyde via source: { type: file, data: ./Child.flyde }
- Move
Child.flyde to a subfolder — verify Parent.flyde updates to ./subfolder/Child.flyde
- Move
Parent.flyde to a subfolder — verify its reference updates relative to new location
- Move a
.flyde.ts code node file — verify referencing flows update
- Move unrelated files — verify no
.flyde files are modified