Reputation: 39239
I have a set of functions defined in a file. They are arbitrarily ordered.
function foo() {
// func body
}
function bar() { /* func body */ }
function baz() { /* func body */ }
I would like some tool which will reorder them alphabetically by function name, i.e.:
function bar() { /* func body */ }
function baz() { /* func body */ }
function foo() {
// func body
}
(Note that simply sorting the lines of code alphabetically wont work.)
I'm interested in a general solution to this problem, as well as in my specific case—which is that I'm writing JavaScript and the editor I use is Sublime Text 3.
Upvotes: 2
Views: 1305
Reputation: 493
The Multi Select Alphabetizer sublime plugin might be useful. Not able to test it at work so YMMV.
If you're feeling particularly adventurous you can try to convert this Sublime plugin from PHP to JS to fit your needs.... It's a bit surprising to me that a more general solution for this hasn't already been developed!
Best of luck.
Upvotes: 3