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.