ClassificationTypeDefinition list of BaseDefinitions for Visual Studio 2010
Does anyone know where I can get a list of BaseDefinitions
for the ClassificationTypeDefitions
in Visual Studio 2010?
I'm trying to define a base definition of "UserTypes" but it doesn't seem to work. For those that don't quite know what I'开发者_Go百科m talking about and need code to make it easier...
[Export(typeof(ClassificationTypeDefinition))]
[Name("keyword")]
[BaseDefinition("keyword")]
internal static ClassificationTypeDefinition KeywordDefinition = null;
That currently uses the keyword definition of c# for highlighting or what not. But I can't seem to get the one for User types to work (Class/enum/structure names and other similar objects). I've tried using the vs settings file and using the definitions defined in there but the definition "User Types" didn't work.
Thanks, in advance
The PredefinedClassificationTypeNames
type has a list of common/shared ones, but "User Types" is an example of one that is supplied by languages.
The short answer is that the [BaseDefinition]
should match up with the display name in the Fonts and Colors dialog for language services that haven't moved off the VS2008 interfaces (like C#). If it isn't working when that is the case, you may be able to convince it to work by adding a second classification type definition with that name ("User Types").
The long answer is this:
In order to supply classification type information for these languages, the editor dynamically generates them the first time you open a file that is associated with a language service. The synchronization process is essentially:
- Walk through the colorable items provided by the language service (
IVsColorableItemsProvider
) - If any of the colorable items don't have associated classification types, generate a new classification type for it (using
IClassificationTypeRegistryService.CreateClassificationType
). - Walk through the information from Fonts and Colors to create/modify formatting information for these classification types
So the problem would be that the type doesn't exist at the time that your classification type definition is picked up by the editor. However, adding a classification type definition for the would-be-dynamically generated type should keep both parts happy: your type's base definition will be set up correctly, and the synchronization process will happily skip step #2, since there is already an item by that name.
精彩评论