VS 2010 Code Intellisense Improvements (VS 2010 and .NET 4.0 Series)

This is the tenth in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release. 

In today’s blog post I’m going to cover a small but really nice improvement to code intellisense with VS 2010 – which is its ability to better filter type and member code completion.  This enables you to more easily find and use APIs when writing code.

Code Intellisense with VS 2008

To help illustrate this intellisense improvements coming with VS 2010, let’s start by doing a simple scenario in VS 2008 where we want to write some code to enable an editing scenario with a GridView control.

We might start off by typing “GridView1.Edit” to bring up intellisense to see what Edit members are available on the control.  Doing this with VS 2008 brings up the intellisense drop-down and filters the current location in the dropdown to the members that start with the word “Edit”:

image

This is great if the method/property/event we want to work with starts with “Edit” – but doesn’t really help us if the “Edit” member we are looking for starts with something else (for example: the “RowEditing” event or the “SetEditRow()” helper method).  We have to either manually scroll up and down looking for the other edit members, or pull up the object browser or help system to find them.

Code Intellisense with VS 2010

Let’s now try out the same scenario with VS 2010.  When we type “GridView1.Edit” within VS 2010 we’ll find that the EditIndex property is still highlighted by default.  But the intellisense list has also been filtered so that it enables you to quickly locate all other members that have the word “Edit” anywhere in them:

image

This allows us to quickly see all of the edit related methods/properties/events and more quickly find what we are looking for.

Searching for Keywords

This new intellisense filtering feature of VS 2010 is useful for searching for any member – regardless of what word it starts with.  For example, if we want to enable paging on a datagrid and can’t remember how to-do it, we could just type “GridView1.Paging” and it would automatically filter out everything but members that have the word paging.  Notice below how no members on the GridView class actually start with the word “Paging” – but I am still finding the two members that do have paging in them later in their names:

image

Searching for Types

This new intellisense filtering capability of VS 2010 is also useful for quickly finding classes and types. For example, when we type “List” to declare a variable, the editor will provide automatic filtering to show all types that have the word “List” somewhere in them (including IList<> and SortedList<> – which do not start with List):

image

This makes it much easier to find type names you can’t entirely remember – without having to resort to searching through the object browser and/or using help documentation.

Pascal Case Intellisense

The .NET Framework naming guidelines specify that type and member names should be “Pascal Cased” by default.  This means that each word in a type or member should start with a capitalized letter (for example: PageIndexChanged). 

VS 2010’s intellisense filtering support now enables you to take advantage of this to quickly find and filter methods based on their pascal naming pattern.  For example, if we typed “GridView1.PIC” VS 2010 would filter to show us the members that have PIC in their name, as well as those members which have a pascal cased name where the word segments start with that letter sequence:

image

Notice above how PIC caused both “PageIndexChanged” and “PageIndexChanging” to show up.  This saves us a few keystrokes when resolving either member or type names. 

Summary

I think you’ll find that the new intellisense filtering approach in VS 2010 makes it easier to quickly find and use classes and members when writing code.  You can take advantage of it with both VB and C#.

Hope this helps,

Scott

P.S. In addition to blogging, I have recently been using Twitter to-do quick posts and share links. You can follow me on Twitter at: www.twitter.com/scottgu (@scottgu is my twitter name)

67 Comments

  • Looks great, unfortunately intellisense is either too slow to work or is not working which is the same thing.

  • This is really great! But I am unsure of how useful the Pascal Casing search is. I can see that it will be useful when browsing the source code (as covered in your last post), but do you think it will be used when we are writing code?
    I suppose you have a good reason to add the feature, so it would be interesting to hear why. :-)

  • I see sign of ReSharper ;)
    Camel Humps name matching rules!

  • Great news, Scott, thanks for keeping us in touch with new features! And what about C++ IntelliSense? Will VS2010 have something like VisualAssist built-in or things remains the same with Ctrl-Space?

  • This is great, often clicking through the list to find something long forgotten takes so much more time than it should.

  • These options are nice. Is there a way to enable / disable this feature?

  • Hmm.. haven't I seen this somewhere else? Oh yeah, resharper? I have noted before that some "new" functionality in visual studio already exists in resharper. How much ideas do you "borrow"? Wonder what Visual Studio would look like if JetBrains had taken patent on all of their ideas? ^^

  • Hello Scott,
    Are there any improvements in intellisense for aspx page ( not code behind). Specially is there are more kind of code blocks allowed ?
    The flexibility to write server side code mixed with HTML was very limited in ASP.Net till now.
    Thanks

  • It's great feature. Thanks

  • I like this improvement :)

    Question: Where could I send in ideas, change requests for your products, like say Visual studio 2010?
    One of many request/idéas would be to change the "add reference"-wizard.
    - Use threading for this wizard Or at least default it to "browse" , instead of w8:ing forever for it to reflect/enumerate all dll's from GAC.
    As it functions now it locks down my IDE until it's finished enumerating :(

  • Hello Scott,

    Nice post and nice feature.
    I'm wondering:
    1. Can we also enable VS2008 like IntelliSense if we prefer that?
    2. What about human intelligence? If I type Edit, I logically can think about all CRUD options...
    Please let me know your thoughts about this.

    Thanks,

    Alex de Groot

  • good ones

  • nice improvement..

  • vs 2010 is rocked.

    But there's a problem fetching when using of asp:textbox Maxlength with texmode=multiline in vs2008 not working.

    Will you please give some comments on that?

  • Camel hump matching intellisense rocks! Not related to intellisense, but can you do a "find type by camel humps"?

  • "Pascal Case" is also in Visual Assist, I use it rather rarely, though.

  • hey scott,
    that is very nice! can you please tell us more about intellisense for javascript, asp.net and web application projects?

    i.e. will intellisense work now if i reference styles.css with "~" (application path) or will there still be the curly green lines under my css class attributes in html?

    in short:
    is VS2010 now capable to resolve "~" (application path) by iis at design time?

    and this in/for:
    .aspx, .ascx and .master files?
    .js files (via ///)?

    it is possible that we can /// a .asmx scriptservice in a separate javascript.js file via "~" to get intellisense there?

    BTW: is it possible that the script handler that produces the json (via myScriptService.asmx/js) will be also capable of including all properties of my custom objects (that i referenced via GenerateScriptTypeAttribute)?

    Many Thanks, Tobi

  • I would love to see intellisense for derived types so we could do:
    ISomeType x = new ..... and here we could get all types that fullfill this contract.

  • Nice Features.

  • I follow your blog on an every day basis.
    I love it.
    I'm counting the days for PDC09. Can't wait for what's comming.

  • @Rune Grimstad> For example in windows forms, try to declare a new DataGridViewCheckBoxColumn, there are an awful lot of types that relate to DataGridView so you really have to type the name up to "DataGridViewC" before relevant matches start to appear.
    So I think that I'll be more than happy to simply type DGVCBC.

  • Wo0ow, that's really great, that's will make writing code more easy, and help us to find what we want in short time.

    Thanks :)

  • Scott,

    Looks good. I've often got fed up with scrolling through the list to find what I want.

    Is there any way of filtering by Fields, Interfaces, Methods, etc?

    Max

  • Oh no ! The days where I was using intellisense to scan for all of an object's properties and methods seems to be over :(
    This feature is not so good to me :/

  • Great work done by micorosoft and great explanation done by you Mr. Scott.

  • really a cool stuff
    thanks to VS team

  • Hi Scott,
    Please could you have a friendly word with your distant colleagues in the SQL Server team and ask them to bring the same to SQL Server Management Stdio?

    THanks
    Jamie

  • Very nice post scott,

    Thanks,
    Thani

  • What about taking a cue from the Office folks and the story they’ve written around paste?

    I think it would be great if when intellisense was invoked, you could tap on CTRL and intellisense would immediately filter the list to in-scope instantiated types.

    I posted an example at my URL, but basically, when I'm assigning a value to an instance of my SomeType class, I would like to be able to hit CTRL and further filter that list in intellisense down to local, member and global instances of SomeType.

    Take this to the next level as well: if I’m assigning a value to a string and I’m looking for a property on a class instance, when I invoke intellisense I could tap CTRL and filter the list of type members down to just strings (much like you're doing with keywords).

    Thanks for another solid release.

    Cheers,
    -cj

  • Hi Scott,

    Will VS 2010 have an option for us to choose between VS2010 intellisense and VS2008? There was usefulness in being able to see the entire set of methods, properties etc. from a class instead of a subset like in VS2010.

  • This updates to intellisense will be handy for sure, thanks, keep the good work going.

  • How about C++ intellisense? Will the parsing be faster/more reliable than in VS2008?

  • Is there a problem with the JavaScript intellisense as reported by RIck Strahl?

    http://west-wind.com/weblog/posts/50857.aspx

    Rgds,
    Anthony :-)

  • I can't seem to be able to change the font used for IntelliSense inside a view (aspx/ascx) in code view mode. In .cs files it uses the right font, only in aspx files it doesn't work. Thanks.

  • Intellisense filtering is a very nice feature.
    I'm not sure yet if "Pascal Case Intellisense" would be useful though. But we'll see.

  • These features look great!

    Rune: The pascal case search will probably be good for accessing members with long names. For example, with VS 2008 you have to do a lot of typing to get DependencyPropertyChangedEventArgs to be near the top of your intellisense results, but if you can just type the first letter of each word you will get there way faster.

  • EXCELLENT! Sounds very helpful. What would really be helpful would be if you could specify the size and amount of information of the intelisense hover / popup window. Its always frustrating having three huge 21" flat panels with epic amounts of information at hand, but having to digest intelisense through the smallest window in VS.net

    Also, parameter / argument information could be displayed in a much nicer and more verbose manner, as eclipse does.

  • I miss not being able to resize the intellisense popup window. I used to have it stretched to it's max vertically so that I could see as many options as possible. In 2010 there's no border on the popup to grab hold to.

  • Until there's some word on how goes the fixing of intellisense-hang-and-not-working-and-crashing-VS problem, I'm not even close to being sold on this.

  • Are the new Intellisense features going to be added to C++ as well? It always seems like they C++ Intellisense feature set lags behind by about a decade or so :(

  • Hello Scott.
    I am a longtime Microsoft developer. I have recently joined a startup company that is using PHP and Apache for its primary web application development. I would like to convince them to switch to using .NET since I think it is a much better environment for the advanced software/website that we are developing. Are there any documents/studies that would help me with my argument?

    Thanks for your time.

    Jay MacDonald
    jay@newvisionit.com

  • I wish I could try that, but VS2010 can't be installed. I've tried 6 times. It's definitely a problem with the web installer. So where's the ISO? My browser is already are great downloader, so Microsoft didn't have to reinvent the wheel there.

  • "Pascal Case Intellisense", this feature is so good, I use this feature a lof when using resharper.

  • Hi Scott,
    Looks great.
    It would be great if it could also support Pascal Case Navigation. (It's already done by DevExpress visual studio addin)

    Right now VS only supports navigation around a word using Ctrl+ArrowKey
    For example now the cursor is at |
    |DataBound
    when i press ctrl+right arrow, it goes to DataBound|

    It would be a great feature if VS could support Alt+ArrowKey
    |DataBound would go to Data|Bound when Alt+left arrow key is selected.

    Its very helpful when selecting using Shift+alt+arrow keys in order to rename

  • The filtering and Pascal casing look great. One thing I'm not happy with is the loss of the ability to hold down the Ctrl key while the intellisense window is open in order to reduce the opacity of the window to take a peek at your code. I use this all the time and it will be a great loss if this feature has been dropped. Also I'd like to be able to resize the intellisense window like we could previously.

  • For anyone who previously used this feature, I've just created a bug on Connect if you'd like to vote for it:

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=501443

  • Hi,

    Can anyone tell me where can I download VS 2010 professional edition.

    Jaswant Singh Rana

    Sequent Technologies

  • No!No!No!No!No!No!No!No!No!No!No!No!No!No!
    If I want to select the Method start with "g", so I type "g". But I can't confirm it's "g" or "j" or "i", so I want to find it start with "g". So I type "g" and scroll the bar up to down to find the right method what I need.
    But after you improved it, I type "g", I think I can't show the word "xml" in the intellisense window. I get a lot of word like "google"/"mpeg"/"ignore" and so on.
    I think It's necessary to add a button under the intellisense window, named like "replace tradition!" or "show all!", then redirect it to the current word what you have typed.
    It's necessary!

  • Intellisense is definitely moving in the right direction, especially for developers who haven't yet opted to buy ReSharper

  • after writing code for several years, I'd like to write pure code instead of drag controls to IDE, with intelligence, it does help me a lot

  • The new intellisense IS pretty cool but there seems to be fairly high computational cost. Running VS2010 B2 on a fairly fast dual-core laptop with 2GB RAM, I find that between the intellisense and general line formatting/highlighting, the IDE is having a lot of trouble keeping up with mornal typing speeds. I'm having to slow down the pace a bit in order to be able to allow the intellisense a moment to respond most of the time. Hopefully this is just an issue in B2 and will be further optimized in RTM, or I'll have a room full of developers with suddenly under-powered hardware.

  • Brilliant, saves lot of time scrolling up and down in intellisense window.

  • Any hope of there being intellisense support inside HTML attributes?

  • This feature is great. I noticed this while I was playing with the new parallel extensions.

  • Now the next step is for the intellisense to mind-read the property name I can never remember the name of. It'd be nice if it could filter the list based on the return type (first using "this."). For example all booleans properties are shown.

  • FANTASTIC!

    is C# intellisense also going to be as good as vb.net now as well? it's never seemed quite as helpful or cooperative to me for whatever reason. BTW: is there truth in that or is it my imagination (can't think of specific examples)

    also the lack of autoupdating the squiggles without building in a lot of c# situations sucks (i know they've made improvements recently - but still not as good as vb.net)

  • I like the keyword filtering, that's a great addition when you are looking for a property/method in a model you are not too familiar with. That said, the Pascal searching doesn't seem like it is that useful but I guess I would have to try it before making such a bold statement :)

  • This is nice. I do think it should either be configurable or change back to the old behavior if I press the Ctrl key or something. It sometimes is helpfull to see all members in the list.

    I also second the notion of Intellisense in SQL Server Managment Studio (PLEASE!! :).

    Also, are there any improvements to javascript intellisense in VS 2010 that are not in VS 2008? More specifically the error messages I get for my custom javascript objects do not report the actual line number. I would like to be able to find what JScript Intellisense finds and is having a problem with.

    Thanks.

  • Ah, this is so welcome... The Pascal Casing is just plain ingenious and it will save a lot of typing.

  • I've always wished that intellilsense would have a way of filtering on types that apply to the left side of the assignment operator, like the following:

    IList foo = new (intellisense filtered on types derived from IList)

    I imagine that could be pretty CPU intensive, however.

  • Thanks, great features...

  • I look forward to the release of VS2010 - it will bring us one tiny step closer to the functionality of Jetbrain's Java IDE, which has been streets ahead for years now. As much as I'm enjoying my foray into the .NET world, I do miss the IDE functionality that I've become used to.

  • Nice! I look forward to the release of VS2010.

  • Scott,

    Thanks for heads-up on new improvements in VS 2010 in IntelliSense. Where the ideas of using more generic infrastracture for IS databases, like SQL Server did go, so that IS can be implemented and enhanced by the language developers so that better languages parity can be provided inside IDE?

  • Nice feature indeed!! It will save a lot of time though...

  • I need to add my voice to the people asking about C++. Same question: will intellisense for C++ be improved in 2010? It's not particularly great in 2008...

  • ms makes developers more lazy :P

Comments have been disabled for this content.