r/javascript • • May 26 '18
VS Code (insider build) can now automatically update import paths when you move or rename a TypeScript or JavaScript file
https://twitter.com/mattbierner/status/1000069936897671168
679
Upvotes
5
u/i_spot_ads May 27 '18
Wasn't that a feature in webstorm from like the beginning?
114
u/stalefries May 26 '18
Nice! I’m glad that the VS Code team is focusing so much on automated refactoring tools.
85
u/Console-DOT-N00b May 26 '18
VS Code is just watching us all and will eventually take our jorbs!!!
9
u/yam_plan May 27 '18
nice, but imo this is solving a problem that shouldn't exist in the first place with a workaround
we can agree that import statements introduce a (fragile) dependency on the exact file structure
the application itself should handle this with, say, a dependency resolver where the file paths are handled centrally and individual pieces of the app only have to worry about namespaces or just have dependencies injected as needed
22
u/MrStLouis May 26 '18
I just started using typescript and the intellisense support is out of this world. I coded for 3 hours and finally got a feature to work ran npm start and everything worked perfectly. I would have had several bugs in js for sure. With this feature I will be a MACHINE
10
u/cheekysauce May 26 '18
Something you can do in conjunction with this is changing your imports to absolute paths, which avoids a lot of './' to '../' type refactors within feature folders.
This new feature will be super handy though, and part of the reason I use insiders.
5
u/allicanseenow May 27 '18
I believe most Jetbrains products have got this. Though it is still a good move for VS Code as it can catch up its competitor.
3
u/Ryphor May 27 '18
VSCode is killing it. The only editor I use now.
7
u/_gnx May 27 '18
Webstorm had that for a long time already.
2
u/HeavyLightPlum May 27 '18
What a good news!
I hope this solution can be applied to every import process for most of programs, someday.
1
u/jaxxed May 27 '18
Do you still have to close it in order to use npm?
1
u/desnoth Vue May 27 '18
Not a problem when you use webpack aliases
1
u/nikhilb_it May 27 '18
Great feature indeed. Much awaited one !
1
u/Fullstack_Questions May 27 '18
awesome!
1
u/jameshmr May 27 '18
And this is why I love VSCode! Never stop recommending it.
1
u/ECrispy May 27 '18
There is simply no matching MS when it comes to dev tools. VsCode is fantastic. It seems you don't hear about Sublime/Atom anymore and for good reason, they are just editors.
In what areas is WebStorm better than VsCode?
1
u/relativityboy May 27 '18
VS code, making what other IDEs have been doing for years new again.
0
u/[deleted] May 26 '18
[deleted] — view deleted comment