Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 code block navigation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

meissnersd
Senior Member

34 Posts

Posted - Sep 26 2006 :  10:53:49 AM  Show Profile  Reply with Quote
Hi,
I love VassistX. Its great!

Ok now for my feature request... :-)

I am often moving up and down a large function.
Down/up arrow it too slow, it hits too many lines.
The Next scope function in VassistX is often too big a step.

I think I want Next/Previous Code Block
It navigates in the Y direction in a file

A block line is any line of code that does not have white space or { }
Non-block are lines with space, tabs, newline and { } char.

So if you started at line 102

line#
100 if( isX )
101 {
102 foo();
103 //stuff
104 // more stuff
105 }
106 else
107 {
108 bar(1);
109 bar(2);
110 bar(3);
111 }
112
112 return false;

Alt-Down arrow is Next Block three times would move the cursor
You would hop to
106 else
108 bar(1)
112 return false

this is a lot faster...
Prev Block would move you up to the end of the previous block of course.




feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Sep 26 2006 :  5:12:10 PM  Show Profile  Reply with Quote
i know exactly what you are after, this is a feature i use a lot in VIM

i recall mentioning this myself a long time ago, and someone saying that they could write a macro in VC6 to do this very quickly, but they did not know how to write a macro in VS2003 to do it.

i have put in a feature request, since i know just how useful this can be. however don't expect this to happen soon, if ever.

case=2726

using the find feature the IDE, set to regular expressions, the find string:
^$


matches a blank line. it might be worth trying to write a pair of macro's to do this, if you have any knowledge of the macro language in your IDE.

the other approach is to try and keep your functions fairly short. i know, easier said than done, but still valid advice.

zen is the art of being at one with the two'ness
Go to Top of Page

meissnersd
Senior Member

34 Posts

Posted - Oct 05 2006 :  12:55:59 PM  Show Profile  Reply with Quote
Hey feline, the macro idea is a good one.
Here is a simple macro that can move you one line past the next curly brace.
Typically, in C++ and C# this is the next "interesting" code block.
It would have to be fixed for VB

I wrotethis macro in MyMacros and mapped it to a hot key.
In Tools->Customize->Keyboard map Macros.MyMacros.BlockStep.PrevStep to CTRL+UP and
Macros.MyMacros.BlockStep.NextStep to CTRL+DOWN.
(Note remove conflicting default keyboard mappings first! ).
That scheme complements well with CRLT-left and right that moves you past a word

It does close to what I want.
'-------------------------------------------------------------
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module BlockStep


Sub NextStep()
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
DTE.Find.FindWhat = "[\\{\\}]"

DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True

DTE.Find.Backwards = False

DTE.Find.Action = vsFindAction.vsFindActionFind
result = DTE.Find.Execute()


DTE.Windows.Item(Constants.vsWindowKindFindResults1).Close()
DTE.ActiveDocument.Selection.LineDown()


End Sub



Sub PrevStep()
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
DTE.Find.FindWhat = "[\\{\\}]"

DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True

DTE.Find.Backwards = True

DTE.Find.Action = vsFindAction.vsFindActionFind
result = DTE.Find.Execute()


DTE.Windows.Item(Constants.vsWindowKindFindResults1).Close()

DTE.ActiveDocument.Selection.LineUp()

End Sub
End Module



Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Oct 05 2006 :  1:04:40 PM  Show Profile  Reply with Quote
very interesting i am going to have some fun studying this

it looks like these use the IDE's build in find dialog. i assume that these DTE calls and the dialog both run through the same underlying code.

does this replace the current find with your search regular expression?
it should not be to hard (optimistic expression) to write the correct regular expression for an empty line, or a line full of white space, once i find the help for the IDE's regular expression syntax.

in long functions - i try to avoid them but they happen all the same, blank lines are a useful separator.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000