Switch the syntax classifier from using "operator" to "script operator", which lets you change the colors of operator characters in visual studio #21

Closed
wants to merge 3 commits into
from

4 participants

@gglresearchanddevelopment

Summary: No matter what settings you change, "Operators" in IronRuby are always green (hex 008080).

I put a few hours into investigating this ( http://ironruby.codeplex.com/workitem/6117 ) and as far as I can tell, it's a bug in visual studio.

The language classifier used by IronRuby (DlrClassifier) is classifying operators using PredefinedClassificationTypeNames.Operator - this is apparently the correct thing to do, but when you do this, the text always comes out green and completely ignores the IDE fonts and colors settings.

Tweaking the classifier to use anything other than PredefinedClassificationTypeNames.Operator works, and allows you to change the color in the IDE settings, but for some reason that I cannot figure out, using Operator always produces the same green.

Commenting out all logic other than the core classification logic (brace matcher, etc) doesn't affect this, and it is also reproducible using the microsoft Ook language sample from here:

http://code.msdn.microsoft.com/ookLanguage

Given that I can't seem to affect it, and it is reproducible in the ook integration, this leads me to believe that it's visual studio itself? I tried to figure out what the C# language does (as you can change "operator" colors in C#), but I couldn't find any classification stuff when running reflector over any of the standard visual studio libraries, so I can't figure out what it's doing differently to make "operator" work.

At any rate, this patch switches the classifier from using "operator" to "script operator". With this patch you can change the colors for "script operator" in the IDE and have them affect operators in IronRuby code

borland and others added some commits May 16, 2011
@qwertie

I'm writing a syntax highlighter for my language (LES) and having the same problem with PredefinedClassificationTypeNames.Operator, except that my operators are always teal rather than green (VS2010). IIRC, this doesn't happen at home where I have VS2013 installed.

@DinoV
IronLanguages member

In PTVS (http://pytools.codeplex.com) we inherit from FormalLanguage on VS 2012 and earlier, and from Operator on VS 2013.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment