Skip to content

Update local flow imports before VS Code file and folder moves - #276

Open
JoaquinBatser wants to merge 2 commits into
flydelabs:mainfrom
JoaquinBatser:fix/update-imports-on-file-move
Open

JoaquinBatser wants to merge 2 commits into
flydelabs:mainfrom
JoaquinBatser:fix/update-imports-on-file-move

Conversation

@JoaquinBatser

@JoaquinBatser JoaquinBatser commented Sep 7, 2026 •

Copy link
Copy Markdown

Moving a flow or its imported file leaves relative paths pointing to the old location. Handle VS Code's onWillRenameFiles event and return a workspace edit before the move. The import rewriter changes only YAML scalar ranges, preserving comments, formatting, and unsaved document edits.

This covers moved files and folders, simultaneous moves, nested inline nodes, legacy import maps, and code-node file imports. Package references and unrelated configuration remain untouched. Moves performed outside VS Code's rename event are outside this change's scope.

Closes #112.

/claim #112

Short demonstration: rendered transcript of an actual VS Code 1.98.2 integration run showing the dirty document before and after a file rename. This is execution output, not a screen recording.

Validation on Windows:

  • 11 path/YAML regression tests passed, including Windows paths, folder boundaries, cross-drive moves, batch swaps, nested nodes, and byte-preserving edits.
  • The rename integration test activates the development extension and uses its existing listener. It does not register a second listener. In VS Code 1.98.2, a minimal development-extension fixture that activates the production rename module reproduced the overlapping-edit failure before the fix and passed all 12 focused tests afterward. This fixture validates the rename lifecycle, not the full Flyde extension startup or monorepo suite.
  • Strict TypeScript compilation of the added implementation and tests passed. ESLint reported no errors.
  • pnpm install --frozen-lockfile --offline passed after adding the already-locked YAML dependency to the extension.
  • Full pnpm build is blocked on this Windows environment by the existing rm -rf dist command in core/package.json ('rm' is not recognized). The full monorepo test suite was not run; the checks above are focused checks, not a claim that the full build is green.

The pure tests can run with pnpm --filter flyde-vscode exec mocha --ui tdd --require ts-node/register src/test/importEdits.test.ts. The VS Code test runner discovers the new integration test alongside existing tests after compilation.

This contribution was developed with AI assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken imports after moving files

1 participant