35

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).

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.

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.

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?

James
  • 2,570
  • 7
  • 34
  • 57
  • 6
    This looks like a good start http://stackoverflow.com/questions/9133887/how-to-extend-intellisense-items – Sepster Apr 01 '13 at 02:45
  • 3
    I've updated your question with detail gleaned from your comments. If you're happy with this edit, please delete your comments. Otherwise, roll back the edit. – Sepster Apr 01 '13 at 04:54
  • 1
    Possible duplicate of http://stackoverflow.com/questions/10460138/custom-intellisense-extension – Simon Mourier Apr 03 '13 at 08:22
  • 1
    @SimonMourier not duplicate, in that thread, op wants to add an item in the intellisense list, but in my thread, I want to add a button, not a plain text. – James Apr 03 '13 at 14:14
  • 1
    Don't think it's possible using the official API, as the Completion class http://msdn.microsoft.com/library/microsoft.visualstudio.language.intellisense.completion.aspx only supports text or icon info. – Simon Mourier Apr 03 '13 at 15:35
  • 1
    @SimonMourier thanks for your reply, I have checked the document, is there any 3rd party API can achieve this? – James Apr 04 '13 at 04:30
  • 1
    Possibly with the help of Resharper. That would be a Resharper plugin. Check this out: http://stackoverflow.com/questions/9133887/how-to-extend-intellisense-items – Simon Mourier Apr 04 '13 at 05:31
  • 1
    This link will provide good guidance to you... I used it when doing the same. [http://editorsamples.codeplex.com/](http://editorsamples.codeplex.com/) – NiNaD PaNDyA Apr 08 '13 at 09:30
  • 2
    If this could be done with a button, maybe it could also be done with any control. I like a colorpicker instead. – King King Apr 12 '13 at 14:43

2 Answers2

1

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

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) Select the code snippet from the code snippet inserter and then press TAB or ENTER, or double-click the snippet.

Jeb's
  • 386
  • 2
  • 10
0

In the IntelliSense property page, clear text box options or check box options for IntelliSense features that you do not want:

Show completion list after a character is typed

Committed by typing the following characters

Committed by pressing the space bar

IntelliSense pre-selects most recently used members applies to IntelliSense for Most Recently Used Members

For more information, see IntelliSense, C#, Text Editor, Options Dialog Box