How to jump to Next statement from For or For Each (like braces but in vb) in Visual Studio 2008
Asked Answered
M

2

5

Does anyone know what the keyboard shortcut for jumping from the start of a keyword, such as for, forEach, if, while etc... is in Visual Studio when your using "vb.net"? I found the following Question, which I thought would do what I was looking for, but it doesn't.

Following a comment from the linked question above, I checked the path:

  • Tools/Options/Environment/Keyboard

...for the Edit.GotoBrace command. From what I read, the command should be mapped to the keybinding: 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?)

Microorganism answered 17/2, 2010 at 10:11 Comment(0)
N
6

For the sake of other SO users, and so the answer isn't buried as a comment inside of an answer:

"...there are keyboard shortcuts (Ctrl+Shift+Up and Ctrl+Shift+Down) that move the editor caret between highlighted references/keywords."

from:

https://connect.microsoft.com/VisualStudio/feedback/details/534430/block-navigation-for-vb-net-similar-to-paranthesis-navigation

Nitrochloroform answered 3/7, 2012 at 18:48 Comment(1)
Wow, where has this been for the last 25 years?! Love it. At last!Woodworth
V
2

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.

Viridity answered 17/2, 2010 at 12:54 Comment(2)
I've put in the request (connect.microsoft.com/VisualStudio/feedback/details/534430/…). 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.Microorganism
I have now had a reply from Microsoft which indicates a partial solution should exist in VS2010 (see URL in previous comment)Microorganism

© 2022 - 2024 — McMap. All rights reserved.