AS3, extract field refactoring is useless...


I am trying to do simle extract field refactoring, and can't make it actualy save my time..!

If I try to use refactor I see:

2014-07-02 14_23_34-starlingObjectSimplified - [E__!workspaceArchive_starlingObjectSimplified] - [st.png

What I want to see:

2014-07-02 14_25_27-starlingObjectSimplified - [E__!workspaceArchive_starlingObjectSimplified] - [st.png

A: name of the field should be preserved.
B: Replace all occurrences should be on by default.
C: There should be option to keep instantiotion in place(off by default), or extract it. (in most cases if your variable is not in constructior, you want to keep instantiation in place.)

Now if I want to extract field I need to:

  • Invoke refactoring. (Ctrl+ALT+F)
  • Rename field name. (Preferably the same that was already used.)
  • check Replace All occurrences.
  • ..(click ok)
  • Cut variable instantiation.
  • paste it to old place.

It is actualy more work then:

  • Copy : "var myObj:Sprite"
  • delete "var" and "Sprite"
  • paste it as new field;
  • add "private". and ";"

Is there option to make refactoring more usefull? Configuration... or template for refactoring?

Thank you for your time.

1 comment
Comment actions Permalink

'Extract field' refactoring is designed to create field based on its usage.
What  you are looking for is something like 'convert local variable to a  field'. Well, good feature request and probably it can be combined with  existing 'Extract Field'.


Please sign in to leave a comment.