all groups > visual studio .net ide > april 2006 >
You're in the

visual studio .net ide

group:

Counterpart to Edit.LineTranspose?


Counterpart to Edit.LineTranspose? Robert Schneider
4/26/2006 12:00:00 AM
visual studio .net ide:
Is there a counterpart to Alt+Shift+T which is Edit.LineTranspose? I guess
not, right?

But this imho is awkward. Like an indicator on a car but only for the left
side, not for the right?

If it doesn't exist could a macro do the same thing? If so could someone
kindly post a macro?

Cheers,
Robert

--
E-Mail: r._sch_nei_d_er#_we_ingar_t_ner.c_om
(remove each '_' from the address and replace '#' with '@')


Re: Counterpart to Edit.LineTranspose? Peter Macej
4/26/2006 12:00:00 AM
[quoted text, click to view]

Isn't this "counterpart" just the same as Edit.LineTranspose applied to
the above line? I would just press ^ arrow and then Alt+Shift+T. Maybe
that's the reason why counterpart doesn't exist.

[quoted text, click to view]

Here it is:

Sub LineTransposeUp()
Dim offset As Integer
Dim sel As TextSelection

DTE.UndoContext.Open("LineTransposeUp")
Try
sel = DTE.ActiveDocument.Selection
offset = sel.ActivePoint.LineCharOffset
sel.LineUp()
DTE.ExecuteCommand("Edit.LineTranspose")
sel.LineUp()
sel.MoveToLineAndOffset(sel.ActivePoint.Line, offset)
Catch ex As System.Exception
End Try
DTE.UndoContext.Close()
End Sub


--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
Re: Counterpart to Edit.LineTranspose? Robert Schneider
4/26/2006 2:22:22 PM
Thanks, that works fine.

One further issue: Is there any way to avoid the balloon message that comes
up from the task bar? It's saying something about the abortion of the macro.

[quoted text, click to view]

One line is okay. But if you want to move it several lines than it's not
that nice anymore. I know, then I could do a copy and paste. But if there is
such an shortcut it is quite more fun. At least to me.

One further optimization would be to move not just one line rather whole
blocks of code.

Actually, this is not my idea. I've used this functionality in Eclipse. I
used it quite often. Now I miss it. You know, once you get used to it...


--
E-Mail: r._sch_nei_d_er#_we_ingar_t_ner.c_om
(remove each '_' from the address and replace '#' with '@')


"Peter Macej" <peter@vbdocman.com> schrieb im Newsbeitrag
news:evF54%23QaGHA.1196@TK2MSFTNGP03.phx.gbl...
[quoted text, click to view]

Re: Counterpart to Edit.LineTranspose? Robert Schneider
4/27/2006 8:07:23 AM
For those that are interested to get rid of the balloon tip, look into this
blog:
http://blogs.msdn.com/johnls/archive/2006/01/17/514004.aspx
and
http://blogs.msdn.com/craigskibo/archive/2004/06/29/169190.aspx


--
E-Mail: r._sch_nei_d_er#_we_ingar_t_ner.c_om
(remove each '_' from the address and replace '#' with '@')


"Robert Schneider" <look.into@the.posting> schrieb im Newsbeitrag
news:%23PHkYxSaGHA.4548@TK2MSFTNGP04.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button