-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Rename File Refactoring #19439
Comments
@waderyan this would best require some support from TypeScript to find all places where the file to be moved is referenced. |
The change file location refactoring required to implement this is tracked by microsoft/TypeScript#6487 |
I believe webstorm has this functionality already, which would mean this is possible without needing changes to typescript? Unless this issue is specifically for refactoring typescript and not ES6 javascript? |
this would be nice! |
Is this issue only about TypeScript? If something was implemented upstream for this, would it also benefit JavaScript files? And what about all other file types? What if we used an implementation that would work for all files? Anytime a file is renamed/moved, search all files in workplace for references to that file, and update the references. For each folder in the workspace, we calculate what a relative path to the renamed file would look like. Then search all files in that folder for a string that matches that relative path, and update any that were found. Or something along those lines... |
@adenflorian I also think this is not limited to Typescript. |
Hi, any news? |
Need this feature too |
I think this would be exceptionally useful! |
Coming to VS Code from WebStorm this is the only feature I found myself seriously missing! Not just for TypeScript, but for ES6 and every other language. I'm not sure how JetBrains implements it, but I wonder if it would be possible to recognize path strings in the code and when a file within the project is moved or renamed, all path strings affected by the change could be updated. Edit: I missed @adenflorian comment above somehow. +1 |
How can people code without this feature?! This is the only reason stopping me from switching over to VSCode from WebStorm. |
Hello @webberwang, while I also miss this feature a lot, this extension helps (even it's not as comfortable as Webstorm): https://marketplace.visualstudio.com/items?itemName=stringham.move-ts (tbh for larger refactorings I still temporarily switch back to Webstorm) |
@nilshartmann thanks for the suggestion, I'll check out that extension |
Seems implemented and just merged in Typescript - microsoft/TypeScript#23726 |
Fixed by #50074 However the feature only works if you are using the latest The initial version also only support single file moves/renames. Extending this to whole directory moves/renames is tracked by #50244 |
When moving a file (drag'n drop), we then have to manually change every path where we used that file.
It would be nice to update all the
import
where we used that file.The text was updated successfully, but these errors were encountered: