Rubberduck: Refactor Extract Method Should Tell Why it Fails

Created on 12 Dec 2017  路  11Comments  路  Source: rubberduck-vba/Rubberduck

Sometimes when I select a block of code and then try to "Refactor Extract Method" it does nothing. I assume this is because it can't refactor my selected block for some reason. It would be helpful if Rubberduck told me why it couldn't refactor that block of code.

refactoring-extract-method status-bydesign support

Most helpful comment

I look forward to a well-oiled version of Extract Method. It's a tremendously useful capability for refactoring.

P.S. I'm in awe of the responsiveness of the Rubberduck staff! Multiple exchanges with two different staff members in 24 minutes - impressive!

All 11 comments

What version are you using? Extract Method was originally shipped in v1.2, removed in v2.x, and is currently being re-rewritten (it's... a complicated one :wink:) - long story short, I don't expect the current WIP implementation to have released.. or did you build your own ducky from the source code?

I'm using Rubberduck 2.1.1.2532

@BriargateExcel we are surprised here because the method is not supposed to be enabled at all.

Were you using right-click menu or hotkeys?

I'm using Hotkeys: Ctl+Shft+M

From the ribbon: Rubberduck -> Refactor does not list Extract Method as an option

From a Right-Click on the selected block of code: Rubberduck -> Refactor does not list Extract Method as an option

Aha, thus lie the rub.

We meant to disable this since some version ago (I want to say 1.4 but I'm not 100% sure when) becuase there were numerous problems with the existing implementations.

But we did not account for hotkeys still working. We will disable it until the WIP is ready. You can see the progress here. Currently it shows all items in TODO but that's because they are all being worked on collectively.

Right... that's the borked version without a UI (@bclothier not sure what version it shipped in, IIRC 1.4.3 still had my original implementation)... the code wasn't deleted for reference, but we removed the menu items - looks like the command's hotkey somehow remained in there...

Well, Extract Method is bring rewritten from scratch anyway :smile:

The result will be much more user-friendly (will show a preview, and will let you decide what happens to the possible inputs/outputs)... and less bugged-up.

I look forward to a well-oiled version of Extract Method. It's a tremendously useful capability for refactoring.

P.S. I'm in awe of the responsiveness of the Rubberduck staff! Multiple exchanges with two different staff members in 24 minutes - impressive!

We get notified in our warroom: https://chat.stackexchange.com/rooms/14929/vba-rubberducking. Feel free to join.

we're cheating we have a chatbot :smiley:

image

We eagerly sit around waiting for requests and hope you'd join us at the pond linked above.

"staff members"??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hosch250 picture Hosch250  路  3Comments

Gener4tor picture Gener4tor  路  3Comments

philippetev picture philippetev  路  3Comments

retailcoder picture retailcoder  路  3Comments

Inarion picture Inarion  路  3Comments