I couldn’t figure out exactly where to ask this question, so I thought I’d try the 'Dope.
I am editing a nodejs application using Sublime Text 2 (on a Mac).
Let’s say that I have a file called foo.js and I am requiring a module in it like so:
var bar = require(’./bar’);
Let’s say that I decide to move bar to a subdirectory relative to where it is now called baz. The directory structure now looks like this:
foo.js
/baz
bar.js
Is there a plug-in or something that will automatically update wherever this module is required so that I don’t have to manually change it to
var bar = require(’./baz/bar’);
?
If such a beast does not exist, does it exist for Atom?
Otherwise, you might want to try a “true” IDE with understanding of the programming language. I really like WebStorm (or PHPStorm if you use PHP alongside JS), but there are many out there. This would be a standard, automatic refactor in a program like that.
I don’t think Sublime (as awesome as it is) actually understands the language logic, beyond just basic syntax highlighting.
I could be wrong, though…
Also, for questions like this, StackOverflow is almost always your best bet. Or the Sublime forum. Or the Sublime developer – in my previous emails, they’ve been very helpful.
I have a plugin that will open the file from that kind of include/require link, but I haven’t found one that will actually link the statements to the file itself, and change one if the other is modified. It would be a handy plugin, though… might be worth the time to create one. I’ll look into doing that, unless somebody finds one, in which case, please let us know. However, I’m using Sublime 3 (on both Mac and Windows), so I’m not sure it would be compatible with 2.