I am working on a LanguageService for Visual Studio and am having issues with custom colors in Visual Studio 2013. I recently moved from Visual Studio 2010 to 2013, and now whenever I set RequestStockColors
to false
, I lose all syntax highlighting.
My LanguageService implements GetColorableItem
and GetItemCount
. I am using 9 custom colors. When I debug my language service, I have noticed that GetColorableItem
is called a handful of times, but GetItemCount
never gets hit.
I am using the following command-line arguments when I debug through Visual Studio:
/ranu /rootsuffix Exp
Update: I changed the name of the first 5 colors (the ones that overlap with the standard token colors) to match the standard names (e.g. "Keyword", "Identifier", etc.) and those colors now show, but none of my extra color types show up. In addition, I never see any of them appear in the Fonts and Colors configuration in Visual Studio. How do I get them to be installed there?
It turns out I needed to create an instance of ClassificationFormatDefinition
for each of my custom colors and export them as a EditorFormatDefinition
type. Once I did this, they showed up in the Fonts and Colors page and also showed up in syntax highlighting.
For each color beyond the default 6, I added a class definition as follows:
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "<name of color>")]
[Name("<name of color>")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class ExampleColor: ClassificationFormatDefinition
{
public ExampleColor()
{
this.DisplayName = "<name of color>";
this.ForegroundColor = System.Windows.Media.Color.FromArgb(0, 0, 128, 128);
}
}
I am still seeing no hits on my GetItemCount()
method, however.