[Ann] : LineUpAndDownMoverPlugin v0.1

This plugin adds 2 actions to the editor

  • Move the current line 1 row up.

  • Move the current line 1 row down.


  • Example : *


before :
-


one
t|wo
three

after :
-


one
three
t|wo



Keymap suggestions :

[Up] : Move 1 line up
[Down] : Move 1 line down



To do : move block of lines


Alain Ravet

0
Avatar
Permanently deleted user

version 0.2 available
-


http://www.intellij.org/twiki/bin/view/Main/LineUpAndDownMoverPlugin


Added :
- move a block of lines up/down.

0
Avatar
Permanently deleted user

But Alain, where are the tests? You do have tests, right? ;-P
Just kidding. I could not help myself sorry....

Very useful plugin! Thanks

Jacques

BTW I am in the process of finishing up a test plugin:
1) Navigate from class to test class (and vice-versa)
2) Create test class if not already there.
3) Configurable test location pattern

"Alain Ravet" <alain.ravet.list@wanadoo.be> wrote in message
news:ap7paf$vt8$1@is.intellij.net...

version 0.2 available
---------------------
http://www.intellij.org/twiki/bin/view/Main/LineUpAndDownMoverPlugin

>
>

Added :
- move a block of lines up/down.

>


0
Avatar
Permanently deleted user

Question to IntelliJ people : 21 lines down.

Jacques Morel wrote:
> But Alain, where are the tests? You do have tests, right? ;-P
> Just kidding. I could not help myself sorry....

Very good kidding; you found the problem : how to test/write test first
plugins? For this one, I kept iterating this loop
- write code in main IDEA session
- make jar and deploy into a separate copy of IDEA plugins directory
- launch and test into this 2nd copy of IDEA
- find problem, and think about solution
- goto begin of loop

(I used ..... System.out.println ("...");, a lot
I know, it's bad. I'm not proud of it.
)

I guess people at JetBrains have a special framework, or custom-made
mock-objects, or ....

Question to JetBrain : how do YOU test (write) plugins? Could you share
a little of your knowledge, experience, tips, tools?

Alain Ravet

0
Avatar
Permanently deleted user

Jacques Morel wrote:

> BTW I am in the process of finishing up a test plugin:
> 1) Navigate from class to test class (and vice-versa)

If it answers simply/quickly the question :
"Where is/are the test(s) that exercise(s) this method"
it will be a blessing.


Alain

0
Avatar
Permanently deleted user

Great plugin Alain. Just a small note - the plugin seems to scroll the
editor pane when moving line(s) upwards, but not when moving lines
downwards. That means your line can drop off the end of the screen.

N.

Alain Ravet wrote:

This plugin adds 2 actions to the editor

  • Move the current line 1 row up.

  • Move the current line 1 row down.

>
>
>> * Example : *|
>

before :
---------
one
t|wo
three

>

after :
---------
one
three
t|wo

>
>
>

Keymap suggestions :

>

[Up] : Move 1 line up
[Down] : Move 1 line down

>
>
>

To do : move block of lines

>
>

Alain Ravet



0
Avatar
Permanently deleted user

Version 0.3 is available


v0.3 changes :
-



- fixed : caret move out of screen when moving down past
the screen bottom.
- added : default keymaps (Ctrl-Shift-I/K)


http://www.intellij.org/twiki/bin/view/Main/LineUpAndDownMoverPlugin

0
Avatar
Permanently deleted user

Nathan Brown wrote:

.. your line can drop off the end of the screen.


Thanks for the info, Nathan.
I fixed this bug in version 0.3


I just had to add 1 line,
editor.getScrollingModel().scrollToCaret ( ScrollType.RELATIVE);

, after making sure that the caret is placed at the begin/end of the
selected block, when going up/down.

Alain



0
Avatar
Permanently deleted user

Might not Ctrl-Shift-UP and CTRL-SHIFT-DOWN be better?
Or are those already claimed for something else?

Alain Ravet wrote:

version 0.2 available
---------------------
http://www.intellij.org/twiki/bin/view/Main/LineUpAndDownMoverPlugin


Added :
- move a block of lines up/down.



--

Erb

==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================

0
Avatar
Permanently deleted user

Erb wrote:
> Might not Ctrl-Shift-UP and CTRL-SHIFT-DOWN be better?
> Or are those already claimed for something else?


In the new (v0.3) version, I added default mappings to
[I]
[K]

It's just under the middle finger.

Alain

0
Avatar
Permanently deleted user

Very good kidding; you found the problem : how to test/write test first
plugins? For this one, I kept iterating this loop
- write code in main IDEA session
- make jar and deploy into a separate copy of IDEA plugins directory
- launch and test into this 2nd copy of IDEA
- find problem, and think about solution
- goto begin of loop

>
Like you once said: Amen.

What can I say: misery loves company...

Jacques


0
Avatar
Permanently deleted user

Bug report/feature request:

When I have several complete lines selected (as in triple-click,
then shift+down), the following line is mistakenly included in the selection.
You should check for this special case (last selected character is end of line)
and exclude the following line.

Thanks.

Alain Ravet wrote:

Version 0.3 is available


v0.3 changes :
---------------

- fixed : caret move out of screen when moving down past
the screen bottom.
- added : default keymaps (Ctrl-Shift-I/K)


http://www.intellij.org/twiki/bin/view/Main/LineUpAndDownMoverPlugin



--

Erb

==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================

0
Avatar
Permanently deleted user

Erb wrote:
> When ..(as in triple-click, then shift+down),
> the following line is mistakenly included

If you press , then the caret is positionned on the 2nd line.
In this case, it's a feature.

But, you don't even need to press , to see this behaviour.
In this 2nd case, you can call it a bug.

I'm reaching for my Flea-Tox.

Thanks

BTW, I didn't know about triple-click, or double

Alain

0
Avatar
Permanently deleted user

Version 0.4.0 is available

v0.4.0 changes:

- added: ensure 2 lines are always shown at the top/bottom of the editor
when moving up/down.
- fixed: don't move the last selected line when selection ends at column 0
of the line.
- fixed: smooth scrolling when moving both up and down:
use replaceString instead of deleteString and insertString.
- fixed: relative caret position after the move is the same as before the
move.


Thanks to Alain Ravet for doing all the work. For my first approach at the
plugin api I just did a little refactoring - the algorithm stayed all his
own.


PS:

Alain - I just couldn't work with your codestyle, so I had to layout
everything to my own style. Feel free to re-layout everything again :)


0

请先登录再写评论。