stringham / move-ts

A Visual Studio Code plugin for updating relative imports when moving typescript files and folders in your workspace.
MIT License
52 stars 15 forks source link

Seems to miss files inside index.ts barrells #5

Closed scottwio closed 7 years ago

scottwio commented 7 years ago

First off thanks for the plugin it's amazing, speeds up refactoring 10 times over. I have however notice a issue, whenever I rename or move a file the plugin it will not move rename the file inside index.ts barrel files. For example I have this barrels

shared/index.ts
export { AppStateService } from './state/app-state.service';
export { SpinnerService } from './state/spinner.service';
...
...
...
...

Renaming './state/spinner.service' using move-ts will correctly rename the file in anything that is referencing the files directly with './state/spinner.service' but it will miss anything referencing it for './share/index.ts'. Would be great if this plugin could work with barrels.

stringham commented 7 years ago

@scottwio so the problem is that it does not update relative paths in export statements?

If you rename ./state/spinner.service, to ./state/superspinner.service, you want the index.ts barrel to have:

export { AppStateService } from './state/app-state.service';
export { SpinnerService } from './state/superspinner.service';

Is that right?

scottwio commented 7 years ago

Correct

stringham commented 7 years ago

@scottwio try updating the extension and let me know if it doesn't work for you.

scottwio commented 7 years ago

Works perfectly. Quickest reply / code updated ever, thanks.