They should have shortcuts assigned, specifically Alt-Shift-Ctrl-Up/Down Also note, that you can sometimes reorder things "horizontally" with Alt-Shift-Ctrl-Left/Right, e.g. method parameters. CAUTION: It is textual change, not refactoring, so usages won't be updated, and code validity is not meant to be maintained.
G> This can be done with the commands: G> G> ReSharper_MoveDown G> ReSharper_MoveUp G> Gabriel Lozano-Moran G> G> But they don't have shortcut keys assigned to it out of the box. G> G> "Chris Morris" <chris.morris@einstruction.com> wrote in message G> news:fpeuk4$88f$1@is.intellij.net... G> >> In Eclipse, I can use Alt+Up/Down Arrow to move the selected lines up >> and down within the source. Is there an equivalent action in R#? >>
Actually as far as I know there are double commands:
ReSharper.MoveDown and ReSharper.ReSharper_MoveDown ReSharper.MoveUp and ReSharper.ReSharper_MoveUp
The difference between the two commands is that ReSharper.MoveDown will move down a selection whilst ReSharper.ReSharper_MoveDown will move down the current line. And for the commands to move down or up a selection there are no assigned shortcuts.
They should have shortcuts assigned, specifically Alt-Shift-Ctrl-Up/Down Also note, that you can sometimes reorder things "horizontally" with Alt-Shift-Ctrl-Left/Right, e.g. method parameters. CAUTION: It is textual change, not refactoring, so usages won't be updated, and code validity is not meant to be maintained.
G> This can be done with the commands: G> G> ReSharper_MoveDown G> ReSharper_MoveUp G> Gabriel Lozano-Moran G> G> But they don't have shortcut keys assigned to it out of the box. G> G> "Chris Morris" <chris.morris@einstruction.com> wrote in message G> news:fpeuk4$88f$1@is.intellij.net... G>
>>> In Eclipse, I can use Alt+Up/Down Arrow to move the selected lines up >>> and down within the source. Is there an equivalent action in R#? >>> >
Actually as far as I know there are double commands:
ReSharper.MoveDown and ReSharper.ReSharper_MoveDown
The command ID is “MoveDown” in both cases, so I'd be rather surprised to see them functioning differently. The duplication is a side-effect of Visual Studio integration, possibly coming from older R# versions.
They should have shortcuts assigned, specifically Alt-Shift-Ctrl-Up/Down
FWIW, the R# behavior is a bit different than Eclipse. Eclipse moves the line rather stupidly, but predictably - R# seems to be trying to be smart about it, but I haven't played with it enough to know if I like it - I'm not used to anticipating what it's going to do.
For example, if I'm on a method declaration, it moves the entire method below (Down) the next method. That may be cool once I'm used to it, but I'm not used it at the moment.
Also, R# appears to act only on the line the cursor is on, regardless of the selected lines - where Eclipse moves whatever lines are included (even if only partially) in the highlighted section.
So, in Eclipse, if I have two lines inside a conditional section that I want to move up before the conditional section, I can select parts of both lines, then Alt+Up a few times and it will move these lines for me (and auto-outdent them).
In R#, I can only move the 'thing' I'm on ... ignores the selected lines.
In R# -- well, this is weird. Given this starting code:
if (thingIsTrue) { foo(); } else { bar(); }
If I put my cursor on line 3 (foo()), I can move this line down into the else block, but then I can't move the line back up into the first if block?!? That's strange... I can move it up and down before or after the bar() call, but it limits me to stay in the else block ... ? Or is this user error?
(Just installed 3.1 today - upgraded from 2.5.2).
Also note, that you can sometimes reorder things "horizontally" with Alt-Shift-Ctrl-Left/Right, e.g. method parameters.
Ah, thx for that explanation. I saw that in there before, but wasn't sure what it did.
CM> In R# -- well, this is weird. Given this starting code: CM> CM> if (thingIsTrue) CM> { CM> foo(); CM> } CM> else CM> { CM> bar(); CM> } CM> If I put my cursor on line 3 (foo()), I can move this line down into CM> the else block, but then I can't move the line back up into the CM> first if block?!? That's strange... I can move it up and down before CM> or after the bar() call, but it limits me to stay in the else block CM> ... ? Or is this user error?
This thread feels like a good point for me to interject a minor feature request concerning the move up/down feature:
If you move, say, a method up (ctrl-alt-shift Up) in a long class, as you start to move up, you reach the top of the edit window, at which point the edit window starts to scroll.
However, because you're at the very top of the window, you can't see what's above you as you scroll.
It feels to me that it would be nice if the window started to scroll a bit before you reached the top, so that you could get some idea what was above you.
I doubt this is possible, but without asking, I'll never know...
Up/down moves (should move) it on the same level of nesting. Like if you have
if (cond) { DoSmth(); } foo(); // caret is here
And then invoke move up, you have foo() before the if. It makes it easy to reorder statements on the same level.
If you want to put foo() inside the if block, you have to use move right, i.e. move it to nested scope. This currently would work if you put foo() before the if clause. Or, alternatively, (I guess it is ReSharper 4 early builds feature) you can move "}" down.
It is possible, that it is not right way to do things. We'd appreciate detailed description of how it works in Eclipse, or how you would like to see it.
CM> Ilya Ryzhenkov wrote: CM> >> Hello Gabriel Lozano-Moran, >> >> They should have shortcuts assigned, specifically >> Alt-Shift-Ctrl-Up/Down >> CM> FWIW, the R# behavior is a bit different than Eclipse. Eclipse moves CM> the CM> line rather stupidly, but predictably - R# seems to be trying to CM> be CM> smart about it, but I haven't played with it enough to know if I CM> like it CM> - I'm not used to anticipating what it's going to do. CM> CM> For example, if I'm on a method declaration, it moves the entire CM> method below (Down) the next method. That may be cool once I'm used CM> to it, but I'm not used it at the moment. CM> CM> Also, R# appears to act only on the line the cursor is on, CM> regardless of the selected lines - where Eclipse moves whatever CM> lines are included (even if only partially) in the highlighted CM> section. CM> CM> So, in Eclipse, if I have two lines inside a conditional section CM> that I want to move up before the conditional section, I can select CM> parts of both lines, then Alt+Up a few times and it will move these CM> lines for me (and auto-outdent them). CM> CM> In R#, I can only move the 'thing' I'm on ... ignores the selected CM> lines. CM> CM> In R# -- well, this is weird. Given this starting code: CM> CM> if (thingIsTrue) CM> { CM> foo(); CM> } CM> else CM> { CM> bar(); CM> } CM> If I put my cursor on line 3 (foo()), I can move this line down into CM> the else block, but then I can't move the line back up into the CM> first if block?!? That's strange... I can move it up and down before CM> or after the bar() call, but it limits me to stay in the else block CM> ... ? Or is this user error? CM> CM> (Just installed 3.1 today - upgraded from 2.5.2). CM> >> Also note, that you can sometimes reorder things "horizontally" with >> Alt-Shift-Ctrl-Left/Right, e.g. method parameters. >> CM> Ah, thx for that explanation. I saw that in there before, but wasn't CM> sure what it did. CM>
It is possible, of course. You could file request in our JIRA issue tracker. However, when caret is after the method, you may not see the signature of the method, if the method is long enough. Probably, better way of moving things around is using File Structure and drag'n'drop there?
WD> This thread feels like a good point for me to interject a minor WD> feature request concerning the move up/down feature: WD> WD> If you move, say, a method up (ctrl-alt-shift Up) in a long class, WD> as you start to move up, you reach the top of the edit window, at WD> which point the edit window starts to scroll. WD> WD> However, because you're at the very top of the window, you can't see WD> what's above you as you scroll. WD> WD> It feels to me that it would be nice if the window started to scroll WD> a bit before you reached the top, so that you could get some idea WD> what was above you. WD> WD> I doubt this is possible, but without asking, I'll never know... WD>
It is possible, that it is not right way to do things. We'd appreciate detailed description of how it works in Eclipse, or how you would like to see it.
Ok - knowing the Move Right/Left as a way to move it inside the braces is good.
Eclipse is really simple about things: - whatever lines are contained in the current highlight section are moved up or down - other than proper indenting, Eclipse makes no attempts to be smart about the move, it'll gladly move the lines into an illogical place and leave the code in a state that won't compile. (It's probably easier to experience than describe - Alt+Up/Down are the default shortcuts).
Sounds like the R# approach is as good as Eclipse's - just different. I think Eclipse's is perhaps more intuitive, at least for a beginner - but maybe R#s is more powerful because it tries to help keep the integrity of the code intact.
Now that I know about the Right/Left as well, I try playing with it and see how it goes. (Well, I would like to be able to move multiple lines at once...)
CM> Well, I would like to be able to move multiple lines at once... Well, the only way to have it eventually is to create request in our issue tracking system. People tend to forget what was discussed in forums... And ReSharper developers are human beings, belive it or not :)
If I put my cursor on line 3 (foo()), I can move this line down into the else block, but then I can't move the line back up into the first if block?!? That's strange...
It's a bug indeed.
I can move it up and down before or after the bar() call, but it limits me to stay in the else block ... ? Or is this user error?
To move the statement to an outer block use ControlAltShift+Left (you can then use ControlAltShift+Right to move a statement back into an if block when it's positioned right before the if statement)
WBR, Oleg Stepanov Senior Whiteboard Operator JetBrains, Inc. "Develop with pleasure!" mailto:oleg.stepanov@jetbrains.com
This can be done with the commands:
ReSharper_MoveDown
ReSharper_MoveUp
Gabriel Lozano-Moran
But they don't have shortcut keys assigned to it out of the box.
"Chris Morris" <chris.morris@einstruction.com> wrote in message
news:fpeuk4$88f$1@is.intellij.net...
Hello Gabriel Lozano-Moran,
They should have shortcuts assigned, specifically Alt-Shift-Ctrl-Up/Down
Also note, that you can sometimes reorder things "horizontally" with Alt-Shift-Ctrl-Left/Right,
e.g. method parameters.
CAUTION: It is textual change, not refactoring, so usages won't be updated,
and code validity is not meant to be maintained.
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
G> This can be done with the commands:
G>
G> ReSharper_MoveDown
G> ReSharper_MoveUp
G> Gabriel Lozano-Moran
G>
G> But they don't have shortcut keys assigned to it out of the box.
G>
G> "Chris Morris" <chris.morris@einstruction.com> wrote in message
G> news:fpeuk4$88f$1@is.intellij.net...
G>
>> In Eclipse, I can use Alt+Up/Down Arrow to move the selected lines up
>> and down within the source. Is there an equivalent action in R#?
>>
Actually as far as I know there are double commands:
ReSharper.MoveDown and ReSharper.ReSharper_MoveDown
ReSharper.MoveUp and ReSharper.ReSharper_MoveUp
The difference between the two commands is that ReSharper.MoveDown will move
down a selection whilst ReSharper.ReSharper_MoveDown will move down the
current line. And for the commands to move down or up a selection there are
no assigned shortcuts.
Correct me if I am wrong.
Gabriel Lozano-Moran
"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b150a378ca4146ad4dcd58@news.intellij.net...
>
>
>
>
>
>>> In Eclipse, I can use Alt+Up/Down Arrow to move the selected lines up
>>> and down within the source. Is there an equivalent action in R#?
>>>
>
Hello,
The command ID is “MoveDown” in both cases, so I'd be rather surprised to
see them functioning differently. The duplication is a side-effect of Visual
Studio integration, possibly coming from older R# versions.
—
Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”
Ilya Ryzhenkov wrote:
FWIW, the R# behavior is a bit different than Eclipse. Eclipse moves the
line rather stupidly, but predictably - R# seems to be trying to be
smart about it, but I haven't played with it enough to know if I like it
- I'm not used to anticipating what it's going to do.
For example, if I'm on a method declaration, it moves the entire method
below (Down) the next method. That may be cool once I'm used to it, but
I'm not used it at the moment.
Also, R# appears to act only on the line the cursor is on, regardless of
the selected lines - where Eclipse moves whatever lines are included
(even if only partially) in the highlighted section.
So, in Eclipse, if I have two lines inside a conditional section that I
want to move up before the conditional section, I can select parts of
both lines, then Alt+Up a few times and it will move these lines for me
(and auto-outdent them).
In R#, I can only move the 'thing' I'm on ... ignores the selected lines.
In R# -- well, this is weird. Given this starting code:
if (thingIsTrue)
{
foo();
}
else
{
bar();
}
If I put my cursor on line 3 (foo()), I can move this line down into the
else block, but then I can't move the line back up into the first if
block?!? That's strange... I can move it up and down before or after the
bar() call, but it limits me to stay in the else block ... ? Or is this
user error?
(Just installed 3.1 today - upgraded from 2.5.2).
Ah, thx for that explanation. I saw that in there before, but wasn't
sure what it did.
Hello Chris,
CM> In R# -- well, this is weird. Given this starting code:
CM>
CM> if (thingIsTrue)
CM> {
CM> foo();
CM> }
CM> else
CM> {
CM> bar();
CM> }
CM> If I put my cursor on line 3 (foo()), I can move this line down into
CM> the else block, but then I can't move the line back up into the
CM> first if block?!? That's strange... I can move it up and down before
CM> or after the bar() call, but it limits me to stay in the else block
CM> ... ? Or is this user error?
This looks like a bug, actually :)
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hello,
We appreciate your feedback. The corresponding JIRA request has been created,
and you are welcome to monitor its status at http://www.jetbrains.net/jira/browse/RSRP-58701.
You may want to check our request tracking policy here: http://www.jetbrains.net/confluence/display/ReSharper/ReSharperIssueTracker
Best regards,
- Development Team.
This thread feels like a good point for me to interject a minor feature request concerning the move up/down feature:
If you move, say, a method up (ctrl-alt-shift Up) in a long class, as you start to move up, you reach the top of the edit window, at which point the edit window starts to scroll.
However, because you're at the very top of the window, you can't see what's above you as you scroll.
It feels to me that it would be nice if the window started to scroll a bit before you reached the top, so that you could get some idea what was above you.
I doubt this is possible, but without asking, I'll never know...
Hello Chris,
Now about the moves, once the bug is submitted.
Up/down moves (should move) it on the same level of nesting. Like if you have
if (cond)
{
DoSmth();
}
foo(); // caret is here
And then invoke move up, you have foo() before the if. It makes it easy to
reorder statements on the same level.
If you want to put foo() inside the if block, you have to use move right,
i.e. move it to nested scope. This currently would work if you put foo()
before the if clause. Or, alternatively, (I guess it is ReSharper 4 early
builds feature) you can move "}" down.
It is possible, that it is not right way to do things. We'd appreciate detailed
description of how it works in Eclipse, or how you would like to see it.
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
CM> Ilya Ryzhenkov wrote:
CM>
>> Hello Gabriel Lozano-Moran,
>>
>> They should have shortcuts assigned, specifically
>> Alt-Shift-Ctrl-Up/Down
>>
CM> FWIW, the R# behavior is a bit different than Eclipse. Eclipse moves
CM> the
CM> line rather stupidly, but predictably - R# seems to be trying to
CM> be
CM> smart about it, but I haven't played with it enough to know if I
CM> like it
CM> - I'm not used to anticipating what it's going to do.
CM>
CM> For example, if I'm on a method declaration, it moves the entire
CM> method below (Down) the next method. That may be cool once I'm used
CM> to it, but I'm not used it at the moment.
CM>
CM> Also, R# appears to act only on the line the cursor is on,
CM> regardless of the selected lines - where Eclipse moves whatever
CM> lines are included (even if only partially) in the highlighted
CM> section.
CM>
CM> So, in Eclipse, if I have two lines inside a conditional section
CM> that I want to move up before the conditional section, I can select
CM> parts of both lines, then Alt+Up a few times and it will move these
CM> lines for me (and auto-outdent them).
CM>
CM> In R#, I can only move the 'thing' I'm on ... ignores the selected
CM> lines.
CM>
CM> In R# -- well, this is weird. Given this starting code:
CM>
CM> if (thingIsTrue)
CM> {
CM> foo();
CM> }
CM> else
CM> {
CM> bar();
CM> }
CM> If I put my cursor on line 3 (foo()), I can move this line down into
CM> the else block, but then I can't move the line back up into the
CM> first if block?!? That's strange... I can move it up and down before
CM> or after the bar() call, but it limits me to stay in the else block
CM> ... ? Or is this user error?
CM>
CM> (Just installed 3.1 today - upgraded from 2.5.2).
CM>
>> Also note, that you can sometimes reorder things "horizontally" with
>> Alt-Shift-Ctrl-Left/Right, e.g. method parameters.
>>
CM> Ah, thx for that explanation. I saw that in there before, but wasn't
CM> sure what it did.
CM>
Hello Will,
It is possible, of course. You could file request in our JIRA issue tracker.
However, when caret is after the method, you may not see the signature
of the method, if the method is long enough.
Probably, better way of moving things around is using File Structure and
drag'n'drop there?
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
WD> This thread feels like a good point for me to interject a minor
WD> feature request concerning the move up/down feature:
WD>
WD> If you move, say, a method up (ctrl-alt-shift Up) in a long class,
WD> as you start to move up, you reach the top of the edit window, at
WD> which point the edit window starts to scroll.
WD>
WD> However, because you're at the very top of the window, you can't see
WD> what's above you as you scroll.
WD>
WD> It feels to me that it would be nice if the window started to scroll
WD> a bit before you reached the top, so that you could get some idea
WD> what was above you.
WD>
WD> I doubt this is possible, but without asking, I'll never know...
WD>
Ilya Ryzhenkov wrote:
Ok - knowing the Move Right/Left as a way to move it inside the braces
is good.
Eclipse is really simple about things:
- whatever lines are contained in the current highlight section are
moved up or down
- other than proper indenting, Eclipse makes no attempts to be smart
about the move, it'll gladly move the lines into an illogical place and
leave the code in a state that won't compile. (It's probably easier to
experience than describe - Alt+Up/Down are the default shortcuts).
Sounds like the R# approach is as good as Eclipse's - just different. I
think Eclipse's is perhaps more intuitive, at least for a beginner - but
maybe R#s is more powerful because it tries to help keep the integrity
of the code intact.
Now that I know about the Right/Left as well, I try playing with it and
see how it goes. (Well, I would like to be able to move multiple lines
at once...)
Hello Chris,
CM> Well, I would like to be able to move multiple lines at once...
Well, the only way to have it eventually is to create request in our issue
tracking system.
People tend to forget what was discussed in forums... And ReSharper developers
are human beings, belive it or not :)
Sincerely,
Ilya Ryzhenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hello Chris,
Thanks for feedback!
It's a bug indeed.
To move the statement to an outer block use ControlAltShift+Left (you can
then use ControlAltShift+Right to move a statement back into an if block
when it's positioned right before the if statement)
WBR,
Oleg Stepanov
Senior Whiteboard Operator
JetBrains, Inc.
"Develop with pleasure!"
mailto:oleg.stepanov@jetbrains.com