Sublime Forum

Strange Hashed Syntax Highlighting (bug?)

#1

ST 3168, Win 10 x64

I’m attaching a screenshot of some code highlighted using the Celeste color scheme:

you can see how NAME my super class. is being shown with different color gradations, even though it’s scoped all the same (meta.class); also, within the same word there are color variations.

My understanding was that hashed highlighting is supposed to provide different color variations for every unique token (within possibility), so that they will be colored differently from each other (but each token uniformely colored). In fact, most hashed tokens are being colored that way, but this loose meta snippets seem to be getting odd coloring.

I thought of reporting it because it might be a bug — I was following the updates on hashed highlighting, and if I understood correctly it’s a relatively new feature in ST.

Or is it supposed to work this way?

1 Like

#2

it may depend on how the syntax definition is applying the scope - if it is operating on each character separately then this is probably to be expected, as it will see each character as a separate token, even though the characters all have the same scope

3 Likes

#3

It might be so, because that part of the syntax is still WIP and there are “holes” of uncaptured text for which I haven’t yet written the required context (but I’m still preventing it from popping out of the context).

I would have expected Hashed Syntax Highlighting to only apply to the chosen scopes in the color scheme. Looking at Celeste source I see the hashed colors associated to the scope selectors:

"scope": "source - comment - string - keyword - punctuation - storage - entity - source.css",

… so I guess that the meta chunk from my example falls under that scope selection.

0 Likes

#4

Yes, if you get rainbow colors on an identifier, that means each char is being considered a token in and of itself, and getting hashed individually.

When developing Celeste I found a few instances of this in the Default packages, but haven’t had the time to go through a file a bug for each.

3 Likes

#5

Mhhh … interesting. Sounds like hashed highlighting could also be used to visually “hint-debug” syntaxes, so to speak — well, at least show elements which are being minced char-by-char by the syntax, which in most cases should indicate something is not being covered fully by the context (like in my example above).

I’m sure this can be useful.

I’ve first read about hashed highlighting after a ST update, where it mentioned Celeste scheme using this feature. I then looked it up and learned more about it, and it’s history. It seems a really cool feature.

1 Like