locked
How can I modify the default syntax coloring of a purple background and underlining in a VS2010 language extension RRS feed

  • Question

  • Hello,

    I am developing a domain-specific textual language VSPackage for VS2010 using MEF. Parsing is implemented using Irony. Syntax coloring for all syntactic categories, statement completion, code regions, and quick info all work. However, I am having a hard time figuring out how to modify the following default behaviors:

    (1) All text is underlined by default, including whitespaces

    (2) Whitespace characters have a purple background

    (3) Quickinfo tooltip text displays in a purple background and underlined

    I would really appreciate a hint to resolve this.

     

    Best Regards,

    Mohamed

    Friday, August 6, 2010 8:23 PM

Answers

  • Hi Mohamed,

    That doesn't sound like the editor's default colors, just the example IClassifier and ClassificationFormatDefinition created by the project template for the Editor Classifier Extensibility project. There's no need to keep them around once you have your own Classifiers and Formats up and running. You should be able to delete them.

    Regards,

    Bill Weinberger

     

    Monday, August 9, 2010 6:16 PM

All replies

  • Hi Mohamed,

    That doesn't sound like the editor's default colors, just the example IClassifier and ClassificationFormatDefinition created by the project template for the Editor Classifier Extensibility project. There's no need to keep them around once you have your own Classifiers and Formats up and running. You should be able to delete them.

    Regards,

    Bill Weinberger

     

    Monday, August 9, 2010 6:16 PM
  • Thanks a bunch, Bill, for getting back to me. I mis-clicked and "unproposed" the answer above. I'm not sure what that does :-)

    The default implementations from the project template are not part of my project. I already have my own classification types, classification format, and classifier classes. My classifier inherits from ITagger<ClassificationTag>, not from IClassifier. My content type inherits from "code", not from "text". All derivatives of ClassificationFormatDefinition explicitly set their background to white and certainly have no underlining text decorations. I even went the distance of clearing the TextDecorations collection in classification formatting classes' constructors. However, the problems summarized above persist. For example, in the code snippet below

    if (x < 0) then x = 1 end

    (1) All characters are underlined

    (2) All characters (except the space character) are formatted correctly on a white background while the space character gets a purple background

    (3) Text displayed by the quick info tool tip is underlined with a purple background

    I'll be more than glad to send you the sources of my classification types and classification formatting classes, if you'd like.

    Thanks again for all the help.

    Mohamed

    Monday, August 9, 2010 7:58 PM
  • Even so, as far as I know, there is no purple underlined text coming from inside the VS Editor code. It must be coming from your extension. Do a search in your code for

        this.BackgroundColor = Colors.BlueViolet;

    and

        this

     

     

    .TextDecorations = System.Windows.TextDecorations.Underline;

    You may have kept this around in a EditorClassifierFormat that you repurposed.

    Bill Weinberger

    Monday, August 9, 2010 8:22 PM
  • I had done the searches before posting and made sure the above code is not there.

    It turns out that I needed to reset my experimental instance. So all this time I was looking at old formats being rendered!!

    Many Thanks, Bill, for your help and prompt responses.

     

    Mohamed

     

    Monday, August 9, 2010 9:09 PM
  • I've done that, too. I will be sure to remember that for future reference.

    I'm glad we got it straightened out.

    Thank you for your patience.

    Bill

    Monday, August 9, 2010 9:12 PM