tern
tern copied to clipboard
Renaming an argument fails if it is called after a nested function
Renaming cb won't work in this example
function foo(cb) {
function bar() {}
cb();
}
I'm using the ternjs Atom plugin, so perhaps it's a problem with the plugin code, but I found this unlikely.
PS: Thanks for making ternjs, it's awesome!
Works in Emacs and Sublime Text for me. I couldn't figure out how to access the rename functionality from the Atom plugin.
Works in Emacs and Sublime Text for me.
I've made a mistake, the problem only occurs if foo is called afterwards:
function foo(cb) {
function bar() {}
cb();
}
foo();
I couldn't figure out how to access the rename functionality from the Atom plugin.
In the Atom plugin it's Ctrl+Alt+Shift+C or Ctrl+Shift+P and then Atom Ternjs: Rename.
Also note:
If multiple arguments are supplied, renaming works for none of them.
For example here renaming works nighter for a nor b nor c:
function test(a, b, c) {
function inner() {}
a();
a = 0;
b = 0;
c = 0;
}
test();