Intellisense interaction

I noticed a question on the C# faq by David who asks:


Is it possible when you type {, (, [, etc. to have the IDE automatically insert the corresponding }, ), ] etc.? Does this exist in VS.NET 2003? Am I just blind?

Would it be possible to have intellisense insert the beginning of the text when list values are the same?


If you type


and intellisense displays


could the IDE automatically expand it to


or possibly if you just hit tab to select AppDomain leave the intellisense selection up if there are others that match?


David: there is a new technology called 'snippets' in the editor which allow you to have macro-like expansions that get invoked when you hit tab inside the 2005 IDE. So you could hit 'if' and you would get 'if () { }' with your cursor in between the parenthesis. We supply a default set, but you are free to create your own. Would this help?

Also, Kevin worked on something called 'Shell style completion' which would have this behavior when dealing with completion lists, however, it's not in the community preview we just released. Given the choice of us providing certain completion-styles, versus us opening an API which you could plug into to define your own style, which would you prefer?

Comments (20)
  1. Don says:

    > Given the choice of us providing certain completion-styles, versus us opening an API which you could plug into to define your own style, which would you prefer?

    Default completion-styles first and API later (even much later if need be).

    I have too much code to write and too many API’s to learn as it is.

    Please don’t make me write code just to write code.


  2. Don: Thanks for the input. The problem we face is that we generally don’t have time to do both. We can either provide alternative methods, but then we don’t solve all needs. Or, we can provide an API and then let 3rd parties to do it themselves (or we can then do it in our spare time and add it to GotDotNet, or SourceForge).

  3. APIs. The best way to learn an environment is to work in it. Even taking into account having to learn a new API before you can code 1) you have defaults 2) snippets and source will be posted to message boards across the land for the common desired but alternate behaviors.

    I use <a href="">Whole Tomato’s Visual Assist X</a> software to help with Intellisense. One of the biggest benefits it provides to me is Intellisense like behavior even when the code above where I’m working is broken. That is, if functionA doesn’t compile because I screwed up but I’m working in functionB, if functionA is broken just right Intellisense gets lost and won’t provide me with any help while working in functionB. Visual Assist X manages to handle this situation.

    However, VAX does have the automatic inclusion of the closing braces, parentheses, etc., and frankly it’s annoying. I hate it. With a passion. This probably is a result of my code style but… for that type of activity to be default would absolutely infuriate me. (It can, as you might surmise by my continued use of VAX, be turned off.)

    The only disadvantage the APIs provide is that third party programs will require more resources. Not a huge deal until you’re importing fourteen or fifteen namespaces. VS.NET already has this information loaded; a second copy would need to be accessible for the third party software. (I can’t imagine you’d want to retrieve those huge lists on a consistent basis via a method.)

  4. You know, I use this software on my weblog. Yet I still consistently screw up links.

    Whole Tomato software is at

  5. David Scott says:

    I think the snippets would definately help for the first question.

    As far as the second goes, I will more than likely always say expand the API. I don’t have a problem mucking around with the APIs, especially if it is to build some functionality that not a lot of people are requesting. I would rather you work on something that could benefit everyone vs. something that would benefit a few.

  6. David/Brian/Don. Thanks for your feedback. It’s invaluable in deciding what choices we’ll be making in future versions of the IDE.

    I’d like more than 3 data points. But it is useful to know that it’s not a clear cut issue on what we should be providing.

  7. Brian: I also wanted to mention that we’ve slightly changed the intellisense model in VS 2005. We now bring up intellisense after you type the first letter in an identifier. This seems similar to the Tomato model. Tell us if you like it!

  8. Vince Pacella says:

    This is probably OT , but in C# at the end of some rather fun methods, I’ll have a bunch of closing }}}}}}}}}} for if’s, foreach’s, try’s, et al…

    It would be cool if the IDE

    – Made a region (without putting the text #region/#endregion) out of the levels like it does at the namespace/class/method level

    – or placed a superscript symbol at each matching {}

    Of course make it optional

  9. Vince: Could you explain a little more? In VS 2k5 we’ve at least added brace matching, will that do what you want?

  10. Vince Pacella says:

    I’m not so much concerned about the specifics of thepresentation but as long as there is some visual way to easily identify a brace’s partner, especially in long code sections that would work great.

    Sometimes when I’m tryping a code section I’ll type the closing brace right away , and then as time goes on, and I’m deleting and adding lines (plus all those blank lines which seem to build up at the bottom), the braces get a little out of synch and it takes a bit of work to figure out where in the nesting I am. I have no idea how common this is for other people.

    When you say "Brace Matching" what do you mean?

  11. I think he means what you’re asking for. When you highlight the ending brace the beginning brace will bold, or turn red, and vice versa. It allows for easy identification of the code block that you’re in and is a very nice feature.

    Generally brace matching is done as well as parentheses matching too. I tend to screw up parentheses more than braces, although the compiler barfs those errors out fairly quickly. 😉

  12. Vince: When your cursor is now up against a one of a pair of elements ( { < > } ) we will match the corresponding element.

  13. Vince Pacella says:

    That’s in the new version right? Not 2003?

  14. Joku says:

    I think VS could borrow from Word here. Shift-Enter anyone? I don’t see it being used in the code editor in a useful way. Here’s what I propose:

    Suppose you have typed: (@ marks position of the cursor)

    if (true@

    now if you press shift-enter, the IDE would complete to:

    if (true)



    Now you can write a command


    now if you press shift-enter, the IDE would complete to:

    if (true)





    Other variation of this idea (implement it quick before i patent shift-enter LOL)..

    You write




    The IDE gives ) automatically:

    if (@)

    Now you write true

    if (true@)

    now if you press shift-enter, the IDE would skip over the ) and add space:

    if (true) @

    but pressing shift-enter here would indicate you want to end writing the if () ()’s :

    if (true)




    Write the command(s):

    if (true)




    now if you press shift-enter, the IDE would just skip out of the { }:

    if (true)





    So what good is this ? Well it would be nice for us who are used to out native language keyboards, where getting ( ) or { } requires more than 1 key press, it the shift-enter auto-skip/completion there would be a ton of saving of the { } ) key combos and some saving of using cursor keys to get over the }’s..

    So you could end up saving a whole two minutes in a year with this !!

  15. redguardtoo says:

    You can try FlashIME ( much better than intellinsense, Visual Assist

    for example:

    you can type "#"+return to input "#include"

    or you can type "fncmt" +return to input



    //Function Name: …


  16. redguardtoo: In what ways do yo think FlashIME is better.

    We support use configurable expansions as well, and I’m not sure why auto completing to #include would be desirable behavior in C# which doesn’t have an include statment.

  17. redguardtoo says:

    "#include" is just an example, it means you can change the definition of a word character.

    The keypont is:

    You hardcoded the definition of a word. but in FlashIME, I can configure everything.

    For example,

    "boost" is a word. "boost.filesystem.iterator" is not a word.

    But why not? FlashIME gives you a choice to define what is a word.

    If you like, you can define everything a word

  18. RedGuardToo: I’m not sure what you mean by "we hard coded in what a word was".

    What does it mean to "define everything a word"?

    Could you show an example of how this is useful, and how ‘expansions’ don’t give you this functionality? THanks!

  19. redguardtoo says:

    Because my english is poor, I always select the simple words to express my idea. thus maybe looks i am rude? if so, I apologize.

    What I mean is that basic idea behind some auto-complete software’s core design is wrong. Among those auto-complete softwares, maybe intellicomplete is the best. but it is still un-mature.

    Actually, it is Microsoft whom developed Iput Method Editor (IME) technology. but seems Microsoft have not recognized that same technoglogy can be applied on their IDEs.

    Now, comes to the meaning of "define everything as a word".

    a word is something you want to input by striking the keyboard.

    for example, below is some code fragment from my project:


    class trackIterator : public ExeCtx::trackIterator


    TrackRegistry::const_iterator _iter;

    TrackRegistry::const_iterator _end;


    trackIterator(const TrackRegistry::const_iterator begin,

    const TrackRegistry::const_iterator end)

    : ExeCtx::trackIterator(for_derived()), _iter(begin), _end(end) {}

    void next() { if (!atEnd()) ++_iter; }

    bool atEnd() const { return _iter == _end; }

    const NodeJmp& operator*() const { return *(*_iter); }



    TrackRegistry is a word, serials of space chars, or "::" is not a word?

    If I strike "T" key, you guess I want to input "TrackRegistry"? so Intellisense will give me hint "TrackRegistry" and later input it into the editor, then I type "::", Intellisense list all the method of the namespace TrackRegistry. Then I will strike Return to confirm the guess (for example, const_iterator _iter"). This is called smart guess.

    Actually, I just want to input "TrackRegistry::const_iterator _iter". I am a lazy programmer, I just want to type "T" and IntelliSense should give me the hint "TrackRegistry::const_iterator _iter"? This is named wild guess.

    if I can have a choice to configure intellisense between smart guess and wild guess?

    for the wild guess, a more extreme example is if I type "d" then return, Intellisense should guess I will input the whole webster dictionary into the editor.

    more examples:

    If I type "/", FlashIME will guess I will input "/usr/local/bin/ddd", if I type "C:", FlashIME will guess I will input "c:Program FilesFlashIMEdevime.db"

    If I type "<", FlashIME guess I wll input "<boost/python/filesystem.hpp>"

    How FlashIME guess should be configurable.

    As to configurable, if I choose other languages like python, perl, ruby, lisp and I still want to use VS2003, as an editor, Intellisense will work? As a customer, I buy the VS2003 or 2005, then someday I will use it to develop application in a totally new language on a new platform (linux , for example? +samba, of course) Could I have a FREE and easy way (Click button once or twice) to make IntelliSense know the keywords of the Linux and the new language?

Comments are closed.

Skip to main content