开发者

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

开发者 https://www.devze.com 2023-02-07 20:37 出处:网络
In C# if you start a snippet you press Tab to cycle through the snippet elements, and pr开发者_开发知识库ess Enter to complete and exit the snippet.

In C# if you start a snippet you press Tab to cycle through the snippet elements, and pr开发者_开发知识库ess 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消