简体   繁体   English

如何在VB.NET for Visual Studio 2015中显示片段?

[英]How do you make snippets show in VB.NET for Visual Studio 2015?

Okay so I am a C# developer at heart but have been working for a living in VB for a while now. 好的,所以我是一名C#开发人员,但现在已经在VB工作了一段时间。 I never really thought about it till today but I used to love Snippets in Visual Studio and now I never use them or only sparingly for things like WPF properties. 直到今天我才真正想过它,但我曾经喜欢在Visual Studio中使用Snippets,现在我从不使用它们,或者只是为了WPF属性而谨慎使用它们。 I notice though they don't show up for me. 我注意到他们没有出现在我面前。 They work but don't give me the hints. 他们工作,但没有给我提示。 Is that by design or an option I can set to see them? 这是设计还是我可以设置的选项来看到它们?

EG in simple console app I can type 'arrSort' and then hit enter and I get: EG在简单的控制台应用程序中我可以输入'arrSort'然后点击回车然后我得到:

Dim animals() As String = {"lion", "turtle", "ostrich"}
Array.Sort(animals)

Cool what I want, no problem. 很酷我想要的,没问题。 But I did not see any Intellisense for it and in C Sharp it shows up near immediately. 但是我没有看到任何Intellisense,而在C Sharp中它立即显示出来。 I know you can go (CTRL + K, X) to get a menu of snippets, but then going to another menu to another menu is kind of tedious and defeats the whole point of a time saving of just going '123' (Tab or Enter) and getting an auto fill in suggestion of what I am about to do in a little hover menu. 我知道你可以去(CTRL + K,X)获得一个片段菜单,但是然后转到另一个菜单到另一个菜单是一种单调乏味的方法,并且在整个'123'节省了时间点(Tab或者输入)并在一个小悬停菜单中自动填写我将要做的事情的建议。

From my little experience in VB it seems that some of its Intellisense really shines for the core language features but in Intellisense for Snippets it is very lacking. 根据我在VB中的一点经验,似乎它的一些智能感知系统真的很适合核心语言功能,但在Intellisense for Snippets中却非常缺乏。 Is there an option I can just turn on? 有没有我可以打开的选项? Or am I relegated to having to memorize them or else have the go the traverse the menu option? 或者我不得不记住它们,或者让我们去遍历菜单选项? Because I may work in an area of File Access for a while and then have quick snippets for things with Stream Readers and Stream Writers, then come back in a few months and forget them but an auto fill in may help. 因为我可能会在File Access的某个区域工作一段时间,然后使用Stream Readers和Stream Writers快速获取内容,然后在几个月后回来忘记它们,但自动填写可能会有所帮助。

Using VB: 使用VB:

Type a partial snippet followed with a question mark, then press TAB to see list of possible snippets and their Intellisense. 键入一个带有问号的部分代码段,然后按TAB查看可能的代码段列表及其智能感知。

arr? then Tab 然后Tab

Similarly, type the full snippet followed with a question mark, then press TAB to see the Intellisense for that snippet. 同样,键入完整的代码段,然后输入问号,然后按TAB查看该代码段的智能感知。

arrSort? then Tab 然后Tab

See How to: Insert IntelliSense Code Snippets 请参见如何:插入IntelliSense代码段

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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