Welcome to MSDN Blogs Sign in | Join | Help

JoeN's Blog

XNA Shaman
How to you complete?

One of the things that I spend an inordinate amount of time thinking about and discussing with different people is how customers complete their selections in IntelliSense.  You know the drill, you re typing away in VS and the IntelliSense list pops up. How do you complete the selection? In broad terms you could:

  1. Just keep typing (essentially ignoring IntelliSense)
  2. Hit Tab
  3. Hit Enter
  4. Hit the first ( for a method call
  5. Hit . to get to the next completion list

I always hit Tab but get annoyed because IntelliSense doesn t recognize what I m doing and add the right starting point for the next action (especially creating the opening brace for a parameter call). The one that really gets me going is when I select a method that has no parameters (e.g. ToString(), GetHashCode() etc) why doesn t IntelliSense just add the two braces for me?

I understand that there are circumstances where the braces are not required (passing the method in as a target for a delegate) but these seem like fairly rare compared to actually calling the method. Does this bother you? Perhaps it will now that I have pointed it out (sorry if this has happened).

I m really curious about this a lot of the devs that I talk to about this don t see it as a problem since they typically complete using the first brace of the call so they would have ToString highlighted and then simply hit ( as a way to confirm their completion of ToString. If you ever see me demo the product you ll notice that I have a slight pause when I type because I actually hit Tab to complete the selection and then have to enter the opening (.

I'll give $10 to the first person that yells out Why doesn t IntelliSense complete the brace for you or better yet complete both braces when the method has no parameters at a public conference when an IntelliSense dev is in the room. Then I can legitimately say customers are asking for this feature :-)

Posted: Friday, December 19, 2003 11:00 AM by JoeN
Filed under:

Comments

Derick Bailey said:

I use all of the above methods, depending on what i'm doing, and depending on how much I know about the method or property in question.

for example: if i'm not sure what i'm looking for, i typically continue typing, and just retype until i find what i want in intellisense, manually adding the . etc.

i typically tab through the namespace after i've typed the first part of the name and it is selected.

if i'm assigning a value to a property, i'll tab it then do the = value.

if i'm going for a method, i'll use (

if i'm using a method that i know does not need parameters, i'll Enter through it and go on to the next line (i'm a VB.NET guy so it adds the () for me when i need them).
# December 19, 2003 11:16 AM

Jason Nadal said:

When I'm using intellisense for a method, it's always "(". If I'm using it for a property, I use the enter key.
# December 19, 2003 11:41 AM

Kevin Westhead said:

For properties and other non-braced scenarios I use TAB (I used to use ENTER but this doesn't behave consistently across C# and VB.NET). For methods I would always use "(", however I would learn to use TAB for methods as well if it worked as you described. One thing that I would say is that IntelliSense for enums needs to be improved in C#, i.e. for enum parameters I should automatically get a list of the enum's members.
# December 19, 2003 2:39 PM

JasonM said:

I use "(" for methods, and TAB for props, but I think I would prefer Intellisense to add the "(" for me, that way I could just use TAB either way, and it would remove one more little thing I had to think about.

# January 24, 2004 6:26 AM

Jay Bazuzi [MS] said:

I thought a brace is curly: "{}".
# January 26, 2004 5:45 PM

Scott said:

It never seems to pick the right default for me. So I end up typing out the whole thing, sometimes I hit ctrl-space to finish out whatever I'm typing.
# January 27, 2004 12:26 PM

Michael Giagnocavo said:

With methods, I always hit the (. With a lot of my code, ToString() gets a System.Globalization.CultureInfo.InvariantCulture very often.
One thing I found that REALLY helps me is DevExpress's CodeRush. I have "invc" bound to that long classname. "newcomm" sets up a new SqlCommand, set it to stored procedure, and leaves the cursor ready to type in the name. "cpa" writes the basic code to add a new SqlParameter.

Also, in respect to IntelliSense, CodeRush's IntelliAssist kicks in after 3 chars and helps a lot (all my local vars and parameters are getting better names since it's trivial to use them).

I think VS.NET would gain a lot by integrating some of these features.
# January 27, 2004 7:51 PM

Michael Giagnocavo said:

With methods, I always hit the (. With a lot of my code, ToString() gets a System.Globalization.CultureInfo.InvariantCulture very often.
One thing I found that REALLY helps me is DevExpress's CodeRush. I have "invc" bound to that long classname. "newcomm" sets up a new SqlCommand, set it to stored procedure, and leaves the cursor ready to type in the name. "cpa" writes the basic code to add a new SqlParameter.

Also, in respect to IntelliSense, CodeRush's IntelliAssist kicks in after 3 chars and helps a lot (all my local vars and parameters are getting better names since it's trivial to use them).

I think VS.NET would gain a lot by integrating some of these features.
# January 27, 2004 7:52 PM

Michael Teper said:

Fire up IntelliJ IDEA. They've gone through this excercise over a year ago and have solved the problem nicely. Not trolling, its just been over a year since I used IDEA and I don't remeber the specifics, but I do remember the discussion and the fact that the outcome pleased me greatly. :)
# January 30, 2004 12:48 PM
Anonymous comments are disabled
Page view tracker