IntelliSense/Browsing options in VC++ 2010
Now that Dev10 is getting close to release I want to describe in detail the various options we have included for controlling browsing and IntelliSense in VC++. Note: All information here is specifically about C and C++ and does not apply to C# or VB. Some of the information contained in this blog will be available as part of our documentation, although I go into more detail in some areas.
We have significantly changed how browsing and IntelliSense are implemented as compared with previous versions of VC. Many of you may be familiar with the “NCB” file which was previously used for browsing and IntelliSense. This file is no longer created or used. Instead, we create an “SDF” file, which is used for browsing features and some small parts of IntelliSense. The SDF file is a SQL Server Compact database file. For more detail on the parsing model, see an earlier blog of mine on IntelliSense, Part 2.
Note: If you want to take a look at the contents of the SDF file, you can actually open it using Visual Studio’s database support. Perhaps I’ll write another blog on that.
Here is a screenshot showing the first half of the relevant options for controlling browsing and IntelliSense. The others are scrolled out of view in the right-hand pane. This dialog is accessed from the “Tools|Options” menu item.
These options are arranged alphabetically into 5 categories: Browsing/Navigation, Diagnostic Logging, Fallback Location, IntelliSense, and References.
First of all, we have heard from some people that they would prefer to see positively stated options (i.e. Enable xxx) rather than negatively stated options (i.e. Disable xxx). I can appreciate this perspective, but I won’t go into all the reasons why it was done this way. It was not an arbitrary or capricious choice.
This option completely disables any use of the browsing database (SDF). The database will not be created or opened. It disables all of the other Browsing/Navigation options and it disables all IntelliSense features except for #include Auto Complete. In previous versions, this is equivalent to deleting feacp.dll.
Disable Database Updates
The database will be opened read-only and no updates will be performed as files are edited. Most features will still work although as edits are made, the data will become stale and you will get incorrect results. If the SDF does not exist and you open a solution while this option is set, the SDF will get created, but it will contain no data about the solution.
Disable Database Auto Updates
The code browsing database will not be automatically updated when source files are modified. However, if you select “Rescan Solution” from the project’s context menu in Solution Explorer, all out of date files will be checked and the database updated.
Disable Implicit Files
The code browsing database will not collect data for files not specified in a project. A project contains source files and header files that are explicitly specified. Implicit files are files that are #included’d by explicit files (i.e. afxwin.h, windows.h, atlbase.h, etc). Normally, the system will find these files and index them as well for various browsing features (including Navigate To). When this option is selected, those files will not be indexed and some features will not be available for those files. Selecting this option also implicitly selects “Disable Implicit Cleanup” and “Disable External Dependencies”.
Disable Implicit Cleanup
The code browsing database will not clean up no longer referenced implicit files. This option prevents implicit files from being removed from the database when they are no longer used. For example, if I add a #include referencing mapi.h to one of my source files, mapi.h will be found and indexed. If I then remove the #include, and there are no other references to that file, information on it will eventually be removed (see Rescan Solution Interval) unless this option is set. This setting does not affect an explicit “Rescan Solution”.
Disable External Dependencies
The ‘External Dependencies’ folder for each project will not be created/updated. If you look in Solution Explorer, there is an External Dependencies folder under each project. This folder contains all implicit files for that project. If this option is set, that folder will not show up.
Recreate the code browsing database from scratch upon the next solution load. This option will cause the next solution load to delete the SDF database file, thus causing it to be recreated and all files indexed. The SQL Compact database code is extremely reliable, but given the issues we used to have with NCB files becoming corrupt, we wanted to expose this in the IDE rather than requiring manual deletion of the SDF file in the case where it is necessary.
Rescan Solution Interval
A ‘Rescan Solution Now’ job will be scheduled every ‘value’ minutes. The value must be between 0 and 5000. The default for this is 60 minutes. During a rescan solution, file timestamps will be checked to see if a file was changed outside of the IDE (changes made in the IDE are automatically tracked and files are updated) and implicit files will be checked to see if they are all still referenced. Personally, I like to set this value to 240 minutes or longer as I’m not usually making changes like this.
Note: There was a bug in the release candidate where the IDE would take focus every hour when the rescan solution kicked off, but this has been fixed.
These logging options are provided in case the product team or support needs to collect some advanced information to diagnose a customer issue. The logging information is not really actionable for users and we recommend you leave it disabled. The output is deeply specific to our internals.
Emit information to Output Window for easier debugging of IntelliSense and browsing database configuration. This is the master switch to turn on collection of information.
A number from 0 to 5, where 0 is most quiet and 5 is most verbose. Not much more to say about this.
A filter for logging events. Sum of any: General = 1, Idle = 2, WorkItem = 4, Intellisense = 8, and ACPerf = 16, ClassView = 32. May require exit and reopen of Visual Studio. These are just bit flags indicating what systems we will collect information from.
The fallback location is the location to put the SDF and IntelliSense support files (i.e. iPCH) when the primary location (same directory as solution) is not used. This could be because the user does not have the privileges to write to the solution directory or the solution directory is on a slow device. The default fallback location is in the user’s temp directory.
Always Use Fallback Location
Indicates that browsing database and IntelliSense files should always be stored in your ‘Fallback Location’, not next to the .sln file. The IDE will never try to put the SDF or iPCH files next to the solution directory and will always use the fallback location.
Do Not Warn If Fallback Location Used
Do not inform or prompt you if a ‘Fallback Location’ is used. Normally, the IDE will let you know if it had to use the fallback location. This option turns off that warning.
This value is used as a secondary location to store the browsing database or IntelliSense files. If empty, this will default to your temporary directory. The IDE will create a subdirectory under the specified path (or the temp directory) includes the name of the solution along with a hash of the full path to the solution, which avoids issues with solution names being identical.
Auto Quick Info
Automatically display QuickInfo tooltips when hovering over text in the editor. This option is unusual in that it is stated “positively”. This is because this option already existed in previous version of VC.
Disable all IntelliSense features. The IDE will not create VCPkgSrv.exe processes to service IntelliSense requests and no IntelliSense features will work (QuickInfo, Member List, Auto Complete, Param Help). This does not disable browsing features that rely solely on the database (NavBar, ClassView, Property window, and others).
Disable Auto Updating
IntelliSense updating will be delayed until an actual request for IntelliSense. This can result in a longer execution time of the first IntelliSense operation on a file, but it may be helpful to set this option on very slow or resource constrained machines. Selecting this option also selects “Disable Error Reporting” and “Disable Squiggles”.
Disable Error Reporting
Disables reporting of IntelliSense errors through squiggles and the Error List window. Also disables the background parsing associated with error reporting. Selecting this option also selects “Disable Squiggles”.
Disable IntelliSense error squiggles. The red “squiggles” will not show in the editor window, although the error will still show up in the Error List window.
Disable #include Auto Complete
Disables automatic completion of #include statements.
Use Forward Slash in #include Auto Complete
Sets forward slash ‘/’ to be the #include Auto Complete folder delimiter. The default delimiter is backslash ‘\’. The compiler can accept either, so use this option to select what your code base uses.
Max Cached Translation Units
The maximum number of translation units that will be kept active at a time for IntelliSense requests. The value must be between 2 and 15. This number directly relates to the maximum number of VCPkgSrv.exe processes that will run (for a given Visual Studio instance). The default is 2 although if you have available memory, feel free to increase this value. For instance, I normally run at 5. If I am normally switching between 5 different source (.cpp) files, I won’t be shutting down and relaunching vcpkgsrv processes as I switch.
‘Find All References’ will display raw textual search results instead of using IntelliSense to verify each candidate (faster). We default to setting this option and it was set this way pretty late in the development cycle as we just couldn’t get the speed good enough that we were comfortable always trying to resolve candidates. If you want more accurate results, by all means, turn this off and for smaller solutions, it should work well for you.
Hide unconfirmed items in the ‘Find All References’ results. If you unset the “Disable Resolving” option, you can use this option to hide unconfirmed items in the results.