Extended Apex syntax highlighting configuration

Issue #190 resolved
Vivek M. Chawla created an issue

It looks like the Apex editor is not applying syntax highlighting to everything that should be getting it.

Consider the following screen shot:


The keywords "Map", "Boolean", "List", "String" were not highlighted at all.

The keyword "new" was highlighted correctly the first time it was used, but not the second time.

The "Account" object seemed to get no color or font highlighting, nor did system static class "Schema". Not sure if that last one is by design or not, though.

Comments (5)

  1. Scott Wells repo owner

    Map, Boolean, List, String, Account, etc., are not Apex keywords. They're data types (or the case of Schema, a namespace). Some of those are recognized directly by my Apex parser as primitive and collection types and may highlight as keywords temporarily while the lazy syntax highlighter makes its pass and changes their highlighting to be that of a data type (that's the same pass that italicizes statics, makes static/finals bold-italic, etc.), but once that's complete they won't highlight as Apex reserved words. This is consistent with IntelliJ IDEA's highlighter for Java keywords and data types and actually uses the exact same syntax highlighter configuration.

    The lack of syntax highlighting on the second new operator is a bug, though. That's related to another minor bug I need to fix and results from the type params if memory serves. Should be a very easy one to fix when its time comes.

  2. Vivek M. Chawla reporter

    OK, so that explains why they (Map, Boolean, etc) are being highlighted as I type, but not once I move on.

    If I understand you correctly, IC is pulling it's base syntax color / font settings from the settings for Java? If I wanted to have data types like Map, Boolean, etc. highlighted in a certain color, should I look there to customize?


  3. Scott Wells repo owner

    Yeah, right now there are no distinct highlighter settings for Apex. There's an open enhancement request, but for the moment, it uses the settings for Java (Settings>Editor>Colors & Fonts>Java). I just tested whether changing the settings under Classes and Interfaces to mimic those of Keyword would give you what you're wanting, but it doesn't. We can use this issue to cover the changes required for me to use those configuration settings for references to data types.

  4. Scott Wells repo owner

    Hmmmm...this should have been resolved quite a bit back. I delivered this many releases ago, and I even recently finally fixed the issue with the new operator.

  5. Log in to comment