typescript-plugin-move-file
v0.0.7
Published
typescript plugin that let the user move files and folders fixing all references (refactor)
Downloads
16
Maintainers
Readme
TypeScript plugin for moving files or folders
- 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.
Demos
Moving and renaming a file in Visual studio Code Editor:
Editor agnostic!. See the same demo but in Atom editor:
How to use
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.
TODO
- 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