如何将按钮添加到Visual Studio Intellisense [英] How to add a button to Visual Studio Intellisense

查看:97
本文介绍了如何将按钮添加到Visual Studio Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Visual Studio的IntelliSense返回的选项列表的顶部添加一个按钮.单击该按钮时,将执行我的自定义代码(除其他外,这将导致出现一个弹出窗口).

I would like to add a button to the top of the list of options returned by Visual Studio's IntelliSense. When the button is clicked, my custom code will be executed (which will, among other things, cause a popup to appear).

之所以称之为按钮",是因为当用户单击项目时,我希望显示一个弹出窗口,而不是完成用户输入的常规IntelliSense动作.

I call it 'button' because when the user click the item, I want a popup window to appear, as opposed to the normal IntelliSense action of completing the user's input.

例如,当我们在文本编辑器中输入类名称时,通常,静态属性和静态方法将出现在IntelliSense中.但是我想在该列表的顶部添加另一个项目.

Eg When we input a class name into the text editor, normally the static properties and static methods will appear in IntelliSense. But I want to add another item to the top of that list.

无论什么输入/内容导致IntelliSense出现,该项目都应出现在IntelliSense列表的顶部.该项目将永远不会改变.

This item should appear at the top of the IntelliSense list, no matter what input/content caused IntelliSense to appear. The item will never change.

这有可能吗?如果可以的话,您能为我应该如何实现这一目标提供一些指导吗?

Is this possible, and if so, can you provide some direction as to how I should achieve this?

推荐答案

1)在C#或VB项目中,打开代码文件,然后将光标放在要插入代码段的位置.

1) In a C# or VB project, open a code file and put the cursor where you want to insert the code snippet.

2)通过以下三种方式之一显示代码段菜单:

2) Bring up the code snippet menu in one of three ways:

    Press CTRL+K, CTRL+X.

    On the Edit menu, point to IntelliSense, and then click Insert Snippet.

    Right-click the mouse and then select the Insert Snippet command on the shortcut menu.

3)从代码段插入器中选择代码段,然后按TAB或ENTER,或双击该代码段.

3) Select the code snippet from the code snippet inserter and then press TAB or ENTER, or double-click the snippet.

这篇关于如何将按钮添加到Visual Studio Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆