Share via


TAB TAB TAB

We're going back and forth on a rather narrow design issue in IntelliSense.

Suppose you're writing some code. (It's a stretch, I know.) You go to type an if/else:

        if (expr)

        {

            // ...

        }

        else // here

        {

            // ...

        }

Here’s what happens when you type ‘else’.

1. You hit ‘e’ and the completion list pops up. This behavior is new in Whidbey. Users don’t usually notice the change, but when the do realize it, they are usually enthusiastic about it. Suppose you’re a fast typist, so you ignore the completion list and keep going.

2. You hit ‘l’, ‘s’, and ‘e’, and they appear in your code.

3. You hit ENTER to insert a line break.

Since a completion list is up, the ENTER is a commit action. It doesn’t insert a line break. You have to hit ENTER twice if the completion list was up. (Since a statement ends with ‘;’, it doesn’t have that problem.) You get annoyed & send us feedback via ladybug.

We hear your feedback, and change the behavior. ENTER commits the completion list and inserts a line break.

Now you’re writing code to call a method on a class you don’t know well. You type:

        foo. // completion list pops up

You consider the possibilities, select the one you want, and hit ENTER to commit it. You’re glad that it inserts the method name, but annoyed that it adds a line break. You have to undo/backspace to add the method parameters. You get annoyed & send us feedback via ladybug.

We hear your feedback, and change the behavior. ENTER always commits the completion list. If the contents of the completion list and what you’ve typed are identical, we also insert a newline.

Consider TAB. Similar issues exist here.

Suppose you want to use the ‘for’ expansion. Type ‘fo’ and hit TAB to complete. It completes to ‘for’. Then TAB again to expand. Cool.

Suppose instead you type ‘for’ and then TAB. The completion list is up, so you have to hit TAB once to dismiss it, and once to expand.

Based on the above discussion, we make TAB act like ENTER – it only expands an expansion if the match is exact.

I think this is the behavior we should keep. However, we have gotten a bit of feedback about it.

Consider this:

1. Open a .cs file

2. Go to the top of the file to add a ‘using’ directive.

3. Type ‘using’.

4. Notice that ‘using’ is in the completion list, so hit TAB to commit.

This inserts a “using statement” in a very bogus location.

Are we doing it right?

Comments

  • Anonymous
    August 30, 2004
    The comment has been removed
  • Anonymous
    August 30, 2004
    It seems pointless to have intellisense on something as simple as "else", especially if it causes a (contrived) problem. Let ctrl+space pop up intellisense as it always has, if I really want "else" auto-completed, and only pop up intellisense on non-keyword constructs (variables, methods, etc).

    At the very least, provide an option to revert this behavior. I think I'd find it more annoying than anything (if I don't know that "else" comes after "if", I've got bigger problems that intellisense can't solve -- I'll end up writing code that makes it on http://www.thedailywtf.com)
  • Anonymous
    August 30, 2004
    If Intellisense thinks this should be an "else", it should stop showing once I am done writing the last 'e'. If it thinks this is not an appropriate place for an "else", it should stay open.
    I discussed the cause of this in a feature request I opened [1] and it addresses the exact issue you're talking about.

    [1] http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=42dc0c84-f107-41df-a80f-3700e4eaf496
  • Anonymous
    August 30, 2004
    The comment has been removed
  • Anonymous
    August 30, 2004
    Intellisense on keywords is a little OTT. I can see the annoyance factor overriding any added value. Any chance of making the intellisense configurable so I can say which sets I want to auto-complete? I think I'd want to turn this option off.
  • Anonymous
    August 31, 2004
    My advice/feedback would be to stop overloading whitespace keys for Intellisense functionality. It really breaks concentration when Intellisense does something I didn't want and now I have to correct it. CTRL+SPACE is good...perhaps using SHIFT+ENTER to select from a completion list would work better than ENTER. SHIFT+TAB for expansions, etc.
  • Anonymous
    August 31, 2004
    The comment has been removed
  • Anonymous
    September 01, 2004
    this is the way you should use "else":

    if(...) {
    .
    .
    } else {
    .
    .
    }

    problem solved
  • Anonymous
    September 02, 2004
    The comment has been removed
  • Anonymous
    June 18, 2009
    PingBack from http://firepitidea.info/story.php?id=1021