Skip to content

(javascript, typescript) Incorrect handling of digits after $ in identifiers #3645

@C-Ezra-M

Description

@C-Ezra-M

Describe the issue

$ isn't treated as a character valid in identifiers, even though it is allowed in identifiers, and is treated like alphabetic letters and _. This causes e.g. 1 in $1 to be highlighted like a numeric literal.

Which language seems to have the issue?

javascript, typescript

Are you using highlight or highlightAuto?

I assume highlightElement() uses highlightAuto().

Sample Code to Reproduce

The test code is:

const $1 = "buck-one";
const $this = `${$1}`;
const bu$ = "bus";
const $$ = "buck-squared"
console.log(`${new Date()}, ${90 ^ 34}`);

https://jsfiddle.net/Keyacom/0ezu3jbd/9/

Expected behavior

GitHub syntax highlighting correctly doesn't highlight any digits that follow $. Highlight.js must do the same thing. The refrence code block is in the section above.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions