共用方式為


Visual C++ IntelliSense Options on Visual Studio 2010

One of the requests we that we often heard from our customers was the ability to disable IntelliSense at will. There are ways of disabling it on previous versions via macros and other tricks (more details about that from this blog post) but we all agree that if you want to turn off a feature it should be simple enough.

On Visual Studio 2010 we completely changed the IntelliSense architecture (more details on that from this blog post) and the problems that made people want to turn IntelliSense off are a thing of the past. Without going into much detail here, the big part of the change was in the way we did the parsing (more info on that from this blog post) and that as a result of that we’re not using NCB files anymore to store the IntelliSense information and we’re using SQLCE SDF databases to do so (and in turn retrieve the information using SQL queries). And just as a side note here, this means that if you’re developing addins for Visual Studio you pretty much have access to the same information that Visual Studio itself does regarding IntelliSense (but I’ll leave that conversation, and all the fun stuff you can do with that for another day).

 Even after those changes, we decided to provide our customers with a rich set of options to control how much of IntelliSense they want (if they want it at all). On this post I’ll go over the available option as well as some background as to what’s going on behind the scenes.

Lets start with the basics, the options are available under the Tools Menu under the Options items. This will bring up the Visual Studio options dialog. On the right side panel select Text Editor, C/C++, Advanced.

 

 IntelliSense Options Window

The window is fairly simple, the left pane is the shared Tools -> Options tree menu. On the right are the specific items we’re interested in, the options are divided in categories which are collapsible. Under each category (which we’ll discuss below) you can select the individual options.

 

There are five main categories:

 

· Browsing/Navigation – These all affect the behavior of the IntelliSense database.

· Diagnostic Logging – Enables debug logging for some of the IntelliSense features. This one is more of a troubleshooting option so I’ll skip these options.

· Fallback Location – This controls the default behavior when there are issues with creating the IntelliSense database (for example if you’re opening a project from a network share for which you don’t have write access to).

· IntelliSense – IntelliSense specific options

· References – Find All References options

 

Now for the specifics, some of the Dialogs are self-explanatory so I won’t go into details about those.

 

Browsing/Navigation

 

Disable DatabaseDisable all use of the code browsing database. The database will not be opened or created.

 

Basically this is the main switch to turn IntelliSense off. Since no database file will be touched no IntelliSense parsing will go on. There’s another IntelliSense option (which will get to in the IntelliSense section) to just turn IntelliSense on, that still populates the database. Turning this setting on also disables everything under Browsing/Navigation and IntelliSense (except Disable #include Auto Complete).

 

Disable Database UpdatesThe code browsing database will be opened read-only and no updates will be performed.

 

This means, run IntelliSense with whatever was previously on my database (created from previous sessions).

 

Disable Database Auto UpdatesThe code browsing database will not be automatically updated when source files are modified.

 

IntelliSense information is gathered in real time, however if you got into a state in which vcpkgsvr.exe becomes unstable or where you rather not have background parsing going on you can change the setting here. On a side note, if you do get into such a state with vcpkgsvr.exe by all means open a bug on it (details on how to do so are available on this blog post).

 

Disable Implicit FilesThe code browsing database will not collect data for files not specified in a project.

 

Information files that are not explicitly included in the project file (ie: external dependencies) won’t be parsed into the database so you won’t get any IntelliSense on those.

 

Disable Implicit CleanupThe code browsing database will not clean up no longer referenced implicit files.

 

                When implicit references are removed entries related to these are removed from the database. With this option turned on that information will remain on the database.

 

Disable External Dependencies FolderThe ‘External Dependencies’ folder for each project will not be created/updated.

 

This one doesn’t affects IntelliSense related but worth talking about. All the implicit files will show up on the solution explorer as a separate node (External Dependencies). This doesn’t means that they are actually part of your project but since the IntelliSense database knows where they are and their information you get them visually represented on the Solution Explorer as if it were. Enabling this option removes that node from the tool window.

 

Recreate DatabaseRecreate the code browsing database from scratch upon the next solution load.

 

This is for cases where you think your database is getting corrupted and you rather start it from scratch every time you load the solution. This does means that you’ll have to wait until the solution is completely parsed until you can start getting accurate IntelliSense.

 

Rescan Solution IntervalA ‘Rescan Solution Now’ job will be scheduled every ‘value’ minutes. The value must be between 0 and 5000.

 

Changes you make are parsed in real time (ie: as you make them), however every set amount of time a complete parse is triggered to ensure that the whole database is up to date. This extra parse won’t actually clean up your database and recreate it from scratch but rather scan for changes made on files that are not active (take for example opening one of the header files your project is referencing on a different instance of Visual Studio). By default this is every 60 minutes, by changing this you can control that interval.

 

Fallback Location

 

Always Use Fallback LocationIndicates that the browsing database and IntelliSense files should always be stored in your ‘Fallback Location’, not next to the .sln file.

 

As the description mentions, the default behavior has always been to save the IntelliSense files on the same folder as the solution file. If you rather have them somewhere else (more specifically on the fallback location) you can change this flag.

 

Do Not Warn If Fallback Location UsedDo not inform or prompt you if a ‘Fallback Location’ is used.

 

As we mentioned before if there’s any issues with creating the SDF file a fallback location will be used. By default you get a prompt when this happens and Visual Studio will try to determine a location for you (if you actually want one). Turning on this setting will prevent that initial dialog from showing up (this is the same as selecting the “Do not prompt me again” checkbox on the dialog).

 

Fallback location window

 

Fallback LocationThis value is used as a secondary location to store the browsing database or IntelliSense files. If empty this will default to your temporary directory.

IntelliSense

Before going on with the IntelliSense settings, I’ll briefly go over the features these settings affect since most of them are new in Visual Studio 2010.

 

QuickInfo – This is the tooltip you get when hovering over a symbol (or using the keyboard shortcut Ctrl +K, Ctrl + I).

Squiggles – These are the red curvy lines you get on the editor window when there are errors.

Error Reporting – The errors that cause the IntelliSense squiggles to appear are also displayed on the Error Window (which you can find under the View menu or through its keyboard shortcut Ctrl + \, Ctrl + E)

 

More information about Squiggles and error reporting is available on this blog post.

 

#include Auto Complete – When including files on code you’ll get the same behavior as previous versions of Member List and AutoComplete on these statements.

 

More information about this new feature is available on this blog post.

 

Auto Quick InfoAutomatically display Quick Info tooltips when hovering over text in the editor.

 

Turning this feature off removes the hovering (you can still get Quick Info via the keyboard shortcut).

 

Disable IntelliSenseDisable all IntelliSense features

 

As mentioned previously this will also change the values of all the rest of the options (excluding Disable #include Auto Complete)

 

Disable Auto UpdatingIntelliSense updating will be delayed until an actual request for IntelliSense

 

Instead of database updates happening on real time they will happen upon request.

 

Disable Error ReportingDisables reporting of IntelliSense errors through squiggles and the Error List window. Also disables the background parsing associated with error reporting.

 

Changing this to true completely disables both squiggles and error reporting.

Disable SquigglesDisable IntelliSense error Squiggles.

 

This disables only the visible squiggles (errors still get reported through the error reporting window).

 

Disable #include Auto CompleteDisable automatic completion of #include statements.

 

Max Cached Translation UnitsThe maximum number of translation units that will be kept active at a time for IntelliSense requests. The value must be between 2 and 15.

 

A translation unit (TU) is the term for a source file plus all of its included headers. For each translation unit there’s an instance of vcpkgsvr.exe running. The tradeoff here as usual is memory versus performance, if you like working with multiple source files open in the editor (and you actually swap to them constantly) you will see some performance increase by raising this number. The default value for this is two (which is more than enough for most projects).

 

References

 

The “Find All References” was also improved for this release. Both are basically allowing you to turn the new behavior on or off (more information on the new functionality and the two options on this blog post)

 

Disable Resolving‘Find All References’ will display raw textual results instead of using IntelliSense to verify each candidate (faster).

 

Hide UnconfirmedHide unconfirmed items in the ‘Find All References’ results.

Comments

  • Anonymous
    October 17, 2011
    It is not available--you can't turn it on.

  • Anonymous
    January 22, 2012
    "problems that made people want to turn IntelliSense off are a thing of the past" I've never had to turn intellisense off in the past but I'm seriously considering it now.  Intellisense in C++ used to be slightly inaccurate and limited but relatively performant.  Now I can often go to make some tea and come back before F12 has taken me to where a function is defined.  All I see is the modal dialog informing me that intellisense is being updated.....again....  Admittedly I do have >200 projects in my solution but sadly I need to and intellisense seems to no longer support solutions of this size.

  • Anonymous
    February 07, 2012
    I have basically similar problem as @Ben, F12 takes forever even for a small project ( < 5 files ). For me, it hangs for 10-15 mins and during this time visual studio is unresponsive.

  • Anonymous
    April 26, 2012
    The very first "this blog post" link is broken, it's pointing to some junky site.

  • Anonymous
    May 08, 2012
    The comment has been removed

  • Anonymous
    July 10, 2012
    Ok you want some real test for intellisense, just download this : lambdasoft.dk/.../download.htm and do not forget to also install the following dll : lambdasoft.dk/.../TlbInf32.exe Now try to compile the sample project comet_1b31examplescometASP, it's impossible because intellisense is lost... Too much powerfull c++ for it. However there are some other errors that don't depend on intelissense but to see them you first need to disable it.

  • Anonymous
    January 25, 2013
    What?! IntelliSense taken out of VS2010?! Are you out of your mind? Who are those customers that are making such requests? Are those the same bunch that is telling my managers to abandon VS in favor of other development platforms? Are those the same ones who want to prefix and postfix a simple counter variable with cryptic and senseless paddings like iprtOSModXXXAppZZZCounter_ ? Just for the record - I have 15+ year of experience with VS, have trained scores of developers to use it and was very happy when the IntelliSense came around and relieved me from the wasteful burden to continuously focus on senseless variable and method decoding instead of working on the code itself. Please post a way to enable IntelliSense on VS2010 with a single click - the way it is currently doesn't appear to work. It also thwarts my initiative to upgrade from VS2008 to VS2010.

  • Anonymous
    November 24, 2013
    Just installed VS 2010 but cannot have intellisense working, been trying to look for a solution in the web but isn't successful in finding one. Can anyone give a clear and concise method of enabling Intellisense for VS C++ 2010? Its a nightmare for me without it working.

  • Anonymous
    January 08, 2014
    No one ever asked to disable  IntelliSense.  I see no reason whatsoever to do that. I can't believe I just wasted my money on Visual Studio 2010.

  • Anonymous
    April 22, 2014
    The comment has been removed

  • Anonymous
    April 24, 2015
    The comment has been removed

  • Anonymous
    July 19, 2015
    I don't know if it is an Intellisense problem but my C++ VS2010 editor is totally corrupt and will not locate ANY partial text. i.e if I have CCL_Arctol in a class, and search for arct I am told it does not exist.

  • Anonymous
    August 11, 2015
    Thank you very much for all this info!