Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take references to script local variables and functions into account when moving functions to a different namespace #1

Open
hupfdule opened this issue Nov 18, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@hupfdule
Copy link
Owner

hupfdule commented Nov 18, 2019

Currently only the public function itself is moved when function is renamed to a new namespace.
If that functions references script local variables or functions, another (now manual) refactoring is necessary then.

It would help greatly if this plugin would take such references into account.

Detecting them is easy, as the mandatory s: prefix is easily detectable in the function body.
But what is the expected behaviour?

  • Move the script-local variable / function along with the renamed function? This will break other things, if other functions reference these, too.
  • Copy the script-local variable / function along with the renamed function? This will lead to (often unwanted) code duplication.
  • Inhibit the rename? This would make this plugin quite useless for functions referencing script-local variables / functions (which is likely the majority of functions). On the other hand it would be possible to force renaming by giving a bang (!) to the command.
  • Ask the user on what do to? This can easily get quite complex.

Also there could be a differentation between references to script-local variables / functions that are exclusive to the moved function (used nowhere else) and others that are also used in other places.
In the former case the script-local variables / functions can easily be moved along with the renamed function. The latter case is the complex one.

@hupfdule hupfdule added the enhancement New feature or request label Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant