简体   繁体   中英

How to complete a Visual Studio snippet in VB.NET?

In C# if you start a snippet you press Tab to cycle through the snippet elements, and press Enter to complete and exit the snippet.

In VB.NET you still use Tab to cycle through the snippet elements, but how do you end the snippet? Enter doesn't work and I can't figure out the correct keyboard shortcut

VB snippets don't work the same way as C# snippets. VB snippets don't have an 'end' and instead stay active until you start typing outside of the snippet scope. The best method is to press esc (once or twice depending on your current selection) and then use the arrow keys to navigate.

A great demo video is available on MSDN. It focusses mostly on C# but has some explanation of the VB snippets at the end.

For more information check out the keybinding posters

Enter doesn't work? It's always worked for me when, for example, I add a new line after the end of the snippet. Alternately, you should be able to end a snippet just by navigating somewhere else in the code and typing (or deleting) something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM