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.
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.
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.
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”.
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”.
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.
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.
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 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.
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).
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”.
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.
Disables automatic completion of #include statements.
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.
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.
Nice info but I never had any intent on bringing a legal case against the logging so no need to enable that.
thanks, look fwd to using this!
What's the point of this new system if "goto definition" still relies on a very slow operation which appears to (inaccurately) look for the symbol without using the Intellisense Database ?
Is this still only applicable to C++ or has it been extended to cover C++/CLI too for the release? To put it another way, will a user who is writing in C++/CLI get less intellisense functionality in VS2010 than in VS2008?
But not for C++/CLI... those users are hosed.
Cool. So how is the work on C++/CLI intellisense coming?
Regarding C++/CLI. Browsing features do work for C++/CLI. Intellisense does not. Browsing features include NavBar, ClassView, NavigateTo, Code Definition Window, Properties, and CodeModel.
Intellisense features include MemberList, QuickInfo, AutoComplete, and ParamHelp. (#include AutoComplete is different and does work with C++/CLI)
There are other features that use both the browsing database and IntelliSense. This includes goto def, goto decl, find all refs, and view call hierarchy. When IntelliSense is not available (i.e. C++/CLI), goto def, goto decl, and find all refs still function but are not as accurate as when IntelliSense is available. View call hierarcy, however, does require IntelliSense and does not work for C++/CLI.
We have heard the complaints regarding IntelliSense and C++/CLI and we are looking at what can be done sooner rather than later. The RTM version will not support this, although there are some 3rd party partners, such as Visual Assist from Whole Tomato Software, that can provide some of this support in Dev10.
With what granularity does C++/CLI block Intellisense from working? Does throwing /clr stop Intellisense for the whole project? Does it still work in native code files? Where #pragma unmanaged is in effect? For native classes and functions?
When is the SP1 scheduled? 2008 was 2005 SP2, but 2010 is a brand new vesion, and its SP1 is essential.
IntelliSense will not work for any file that has the /clr flag. If a header file is included by multiple .cpp files and /clr is not used on all of them, you will get IntelliSense for the header file. Pragmas have no impact on whether you get IntelliSense or not.
If you have a lot of native code that is compiled with /clr, you could create a new config that doesn't pass the /clr option and you would then get IntelliSense on the native code. If you have managed code mixed with the native code, you would need to wrap it in #ifdef __cplusplus_cli to avoid a bunch of errors.
I have to comment on this, even though you have a note in the article:
Why use all these double negations? Especially when mixing them with the positive form for 'Enable Logging'.
To continue on my previous post, the following quote was taken from the official Windows User Experience Interaction Guidelines (http://msdn.microsoft.com/en-us/library/aa974175.aspx), part Style and Tone, section Voice:
"Phrase statements in the positive form, and emphasize what users can accomplish, rather than what they can't."
@Ema: I was complaining about exactly the same issue in some post some time ago, but my comment was deleted (there were however several other folks whose comments went through.) There is a bug open now for this (512150), and it was resolved with the explanation that this has too low priority to get fixed :/ (without explaining how it got in in the first place :) )
The loss of IntelliSense for C++ CLI is a kill shot for upgrading for me :( I like the new VS2010, but sadly until the issue is resolved I'll have to stick with 2008. PLEASE please please address this as soon as possible.
It's a bad joke that IntelliSens doesn't work with C++ CLI on VS 2010.
If I was one of the buyers who bought VS2010, I would put MS in a court because they promised IntelliSense on VS2010 and it's not availble on the best language.
Everything they do is because of money, this World is going to the hell, M$'s capitalism sucks!