- Move/rename a file or folder fixing all imports to point to the new location in all the TypeScript project
- Based on [ts-simple-ast])(https://dsherret.github.io/ts-simple-ast) file and directory move() operation
- Editor / IDE agnostic - it should work on any editor that supports TypeScript Language Plugins. Uses typescript-plugins-text-based-user-interaction for interacting with the user via the source file itself.
Moving and renaming a file in Visual studio Code Editor:
Editor agnostic!. See the same demo but in Atom editor:
npm i --save-dev typescript-plugin-move-file
in your tsconfig.json
, add the plugin:
{
"compilerOptions": {
"plugins": [{
"name": "typescript-plugin-move-file"
}]
}
}
Make sure you have installed typescript in your project (npm i --save-dev typescript
) the editor you are using uses that typescript and not another. For example, Visual Studio Code comes with its own typescript version, so you need to "Select TypeScript Version" of the workspace:
{
"typescript.tsdk": "node_modules/typescript/lib"
}
In Atom editor, if you use atom-typescript package you don't need to do anything since by default it will use the workspace's TypeScript version.
- move folder is broken
- show confirmation in the current sourcefile (large projects take several seconds)
- notify last error - adding a comment just below the &%&% comment that failed
- option to undo-last-action