Skip to content

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

@hupfdule

Description

@hupfdule

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions