Skip to content

Implementing extract method #3358

@bclothier

Description

@bclothier

This is going to be first iteration of restoring Extract Method functionality that was disabled from RD, this time NOT regex'ing stuff.

Because there are numerous cases to test, we want to get start with most simplest, dumbest implementation.

Basically, the first iteration should aim to:

  1. expand the selection to complete statements
    a) verify it's within a single procedure
    b) verify for complicating factors (e.g. GoTos, Exits, ....)
  2. collect all local variables used
  3. copy the statements
  4. show the dialog
    a) user choose whether variables are parameters or local
    b) user names the method
  5. add the Dim statements for local variables
  6. insert the method at end of module
  7. replace the original selection with a call to the method, passing in parameters

Note that with 1b, we will disallow selections where it includes flow of control statements that can go to some places not necessarily within the user's selection. That possibly could also include error handling, and of course any Exit, GoTo, GoSub.

Maybe the initial iteration can indicate why it can't extract method (e.g. Exit statement exists in the selection somewhere) so at least it's easy for user to manually fix while we make it smarter in subsequent iterations?

Thoughts? Suggestions?

Metadata

Metadata

Labels

discussionenhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.refactoring-extract-methodwork-itemUsed for features not implemented to document requirements

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions