2
Vote

IronRuby tools for visual studio doesn't allow syntax coloring of punctuation

description

Steps to repro:
 
  1. Install IronRuby 1.1.3 + Tools for visual studio
  2. Use a custom color scheme (or change your default colors using Tools/Options
     
    Note that all items (keywords, strings, etc) respect the color changes in one way or another EXCEPT punctuation, which remains the same sea-green color no matter what you do.
     
    This is not nice if you have a dark background
     
    Punction is more-or less the following characters
    ()-=+[]:,.

comments

orionedwards wrote May 29, 2011 at 10:44 PM

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, I have a small patch which 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

https://github.com/gglresearchanddevelopment/ironlanguages-main/commit/4d8554cf2329ce5dba74e1e2c37e7e1019b7d285

If anyone has more knowledge about VS integration and may be able to help with why the standard "operator" coloring is not working, I'd really appreciate it.
If this is a bug in VS, do I need to file something somewhere? I'm not sure where to go with it.