views:

43

answers:

1

Does anyone know the keyboard shortcut to jump from the start of a For / For Each (or If, While, etc.) block to the end of it in visual studio if you're using vb.net? I found the following which I thought would work but doesn't : http://stackoverflow.com/questions/1501921/go-to-matching-brace-in-visual-studio

Following the comment there I checked Tools/Options/Environment/Keyboard for the "Edit.GotoBrace" command which is mapped to Ctrl+å in Swedish.

Vb.net doesn't use braces per se, but in the following example:

For Each Foo in Bar
    Do lots of stuff
Next

I would have thought that the same command should jump me from the "For Each" to the "Next" but it doesn't do anything. Is there another command (or should that command work but something is broken locally?)

Adam

+1  A: 

No can do. It is a much harder task than matching braces. Finding the matching NEXT keyword requires syntax parsing. Braces can be matched by merely tokenizing the text. I'd recommend you put in a feature request at connect.microsoft.com, it is a good request.

Hans Passant
I've put in the request (https://connect.microsoft.com/VisualStudio/feedback/details/534430/block-navigation-for-vb-net-similar-to-paranthesis-navigation). I wouldn't have thought it so very difficult - the background compiler already keeps track of them and shows an error if there is an unmatched For/Next. In pure vb.net files VS does a pretty good job of indenting based on them too - but in .aspx/.ascx files it doesn't keep up with that so well.
Adam
I have now had a reply from Microsoft which indicates a partial solution should exist in VS2010 (see URL in previous comment)
Adam