question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax highlighter should allow $ in identifiers.

See original GitHub issue

It appears that the syntax highlighter isn’t expecting $ to occur within identifiers, so for instance, $return will have keyword highlighting applied (while, say, this$ and $1$2$ use highlighting for distinguished variables and numeric literals, respectively).

Stopping this extra highlighting is easy enough by qualifying \bs with negative lookaround for \$, similar to VSCode’s JavaScript grammar.

The harder part is ensuring that $ doesn’t stop desired highlighting from occurring. The problem is the grammar here seems to be 10x shorter than a lot of other languages—all we really have are some naive definitions for class / function / constant identifiers, so I’m at a loss for the “right” thing to do.

I can submit a PR with my suggestion: to remove the constant definition (which is actually bogus 😛) and loosen the other two (which should get us pretty close to correct, anyway).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, May 25, 2017

Fixed in 017d17d279abc3e9d439e96b82d8aaab6ee96a7c.

0reactions
DanTupcommented, May 23, 2017

I wondered why you’d be naming variables like this; but makes sense now!

Strange that the lowercase/uppercase a/z are different too!

I will test and merge when I get some free time at PC at home. Ta!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Syntax highlighting | ReSharper Documentation - JetBrains
For example, ReSharper syntax highlighting allows you to easily distinguish between local variables and fields in your code.
Read more >
Syntax Highlight Guide | Visual Studio Code Extension API
Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords...
Read more >
Syntax Highlighting - Help+Manual
Specify whether single or double quotes are to be identified as quotes. Identifiers: The relevant characters that are allowed in identifiers for the...
Read more >
Syntax highlighting - Wikipedia
Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays...
Read more >
What is syntax highlighting and how does it work?
Syntax highlighting allows code in posts to be highlighted based on ... This is a complete list of every identifier that you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found