highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.3k stars 3.52k forks source link

(Haxe) using `new` at the start of a variable name highlights it separately from the rest of the variable name #3992

Closed ninjamuffin99 closed 3 months ago

ninjamuffin99 commented 4 months ago

Describe the issue

When naming a variable with new at the start of the variable name (ex: newAngle), it highlights new separately from the rest of the variable (highlights new one color, then highlights Angle another color)

Which language seems to have the issue? Haxe

Are you using highlight or highlightAuto?

I believe I am using highlight / highlightAll

Sample Code to Reproduce (Sample code is from the haxeflixel.com documentation, the hosted documentation is using a bit of custom highlighting, but it's going to move to highlightjs, which you can test on dev.haxeflixel.com)

var newAngle:Float = 0;
 if (up)
 {
     newAngle = -90;
     if (left)
         newAngle -= 45;
     else if (right)
         newAngle += 45;
 }
 else if (down)
 {
     newAngle = 90;
     if (left)
         newAngle += 45;
     else if (right)
         newAngle -= 45;
 }
 else if (left)
     newAngle = 180;
 else if (right)
     newAngle = 0;

Expected behavior

Usually we'd want new to be highlighted differently (ex: creating a new variable state = new FlxState()), but when it's used as a variable, it should be highlighted as a variable rather than whatever the current implementation is for the new keyword.

Additional context This error can be easily tested from the highlightjs online demo with nearly any theme: https://highlightjs.org/demo