js-emacs / js2-refactor.el

A JavaScript refactoring library for emacs
GNU General Public License v3.0
373 stars 47 forks source link

`js2r-rename-var`: don't go to start of symbol #123

Closed nbfalcon closed 3 years ago

nbfalcon commented 3 years ago

Previously, js2r-rename-var would go to the start of the symbol being renamed first. This makes inserting edits at point inconvenient, because one has to navigate back.

Solve this by first computing a point-delta (how far point is from the start of the symbol), and use that to position the other cursors. Don't goto-char to the start of the symbol for the main cursor.

Fixes #122.


#

nbfalcon commented 3 years ago

As a side note, why is js2r-rename-var not autoloaded?

NicolasPetton commented 3 years ago

@nbfalcon I saw no reason not to autoload the function, I just added a fix for it.

PS: Do you have write access to this repo now?

NicolasPetton commented 3 years ago

@nbfalcon I sort of disagree with the choice here, but I understand that it depends on usages.

NicolasPetton commented 3 years ago

@nbfalcon this broke some ecuke tests, I pushed a fix here: https://github.com/magnars/js2-refactor.el/pull/128.

nbfalcon commented 3 years ago

@NicolasPetton yes I have write access. Do you think whether js2r-rename-var should keep point should be made optional?

NicolasPetton commented 3 years ago

Do you think whether js2r-rename-var should keep point should be made optional?

I'm not sure, I need to experiment a bit more with it.