Saturday, June 10, 2006

New feature in MoveIt

Shock News - MoveIt can now move your code around.
MoveIt has a new feature (inspired by Dan Avni) which allows you to Move code around. Specifically the current statement, declaration or method. Simply bind some keys (I personally use Ctrl-PgUp and Ctrl-PgDown) to the MoveCodeUp and MoveCodeDown actions and you should be able to use those keystrokes to move individual statements, declarations or methods up or down one place at a time.

Note that a blocks of code like If's and foreach's count as single statements so they can be moved in their entirity.

Please note that the plugin tries to guess what you want moved not by what is selected but by where your caret is located at the time of activation.

Comments, as always, are welcome.

Download from http://www.rorybecker.co.uk

Update(13/June/2006):Uploaded new version to correct bug spotted by Karel Kral. Thanks Karel

7 comments:

Anonymous said...

I have tested this plugin with enthusiasm but after some tests i must say, that is too young.

Test this:
public partial class Form1 : Form
{
// comment 1
public Form1()
{
InitializeComponent();
}

// comment 2
public void MyMethod()
{
Console.WriteLine("xxx")
}
}

Try to place cursor on line public Form1() and move this code down. Comments. Comment1 is lost.

Rory said...

Fair comment :)
All my plugins are relatively new and it is with the help of people like yourself, (testing and so forth) that I hope to find bugs and eliminate them so that we can all enjoy the benefits.

Incidentally I have updated the plugin to work in the given cases.
Also attributes and other associated languageelements should be moved along with the original methods. Uploading just as soon as I can

Thanks Karel

Anonymous said...

Thank for so fast update! Im am continue with using this plugin. It is supposed my fovorite plugin -I need to move methods up and down very often ;)

Anonymous said...

My next test and failed ;) Try to move two methods with XML comments. I have posted sample code but blogger cannot accept this.

Rory said...

The main homepage appears to be down also. Try mailing your sample to me at roryb@dxsquad.com

Anonymous said...

I tried this plugin - I have Refactor Pro 2.0, on VS 2003. I see the pages for DeclareIt and MoveIt under NPS in Options.

When I try to set a key-combination, none of the MoveIt items shows up under the actions. I tried manually typing in MoveCodeUp and MoveCodeDown, and it took them, but does nothing.

Is there any documentation somewhere to clarify how to actually activate these once they're installed? Or are they incompatible with 2.0?

Howard C. Shaw III

Rory said...

Hi Howard.

Installation should be very simple. Just drop the dlls into the plugins folder and away you go.

Interesting that you mention refactor but not Coderush.

Do you not have Coderush?

I will try to see if I have bound these plugins to any coderush dlls.

I'm not sure if this will make a difference but I could understand if it did.

I will certainly see what I can do. You are not the first to mention this effect.