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

冷暖自知 提交于 2019-12-23 08:54:02

问题


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


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/4831160/how-to-complete-a-visual-studio-snippet-in-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!