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.

Issue with Highlight Keywords

See original GitHub issue

Ok, well this might no be exactly an “issue” as this actually relates to items that are not keywords. However, what I’d like to do is highlight a token that isn’t a keyword.

The language I selected was C++ and there are macros in my code. I want to highlight those macro names. How would I do that?

Another thing I noticed with Highlight Keywords is the documentation. I was looking at it and it showed the following:

 	.token.keyword.keyword-return, .token.keyword.keyword-if{
 		color: #f92672;
 	}

Well, I tried this and it didn’t work. It took some time in reading and debugging as to what this actually did and I found out what was wrong. I don’t know why .token.keyword were prefixed to the style selector, but that is what the issue was. It should be:

 	.keyword-return, .keyword-if{
 		color: #f92672;
 	}

As a side note. I find this library very nice. Thanks to all who are involved in this project. It makes it easy to style code snippets and is fairly easy to use. Thanks again.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mAAdhaTTahcommented, Nov 20, 2017

If you can write regex, best bet, I think, would be to modify the language definition at runtime, or create an extended language definition. You can see here how C++ extends the C language. You can extend C++ w/ like a “C++ Extras” that includes the keywords you want highlighted, then highlight your code snippets with your new language.

0reactions
Ma-XX-oNcommented, Nov 22, 2017

So it doesn’t reference anything outside? Then I’m at a loss. Now seems to be working with what was documented and doesn’t work with what I’m saying. Very weird.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Highlight keywords in the results for code searches - GitLab
Insight Users prefer when the keywords are highlighted in search code results, making it easier to scan.
Read more >
Outlook search won't highlight keywords in search results
Outlook search won't highlight keywords in search results. When searching for anything in outlook on a Windows Server 2016 terminal server, ...
Read more >
Searched keyword highlighting issue | WordPress.org
Hi I am facing an issue with issue with the keyword highlighting on searched results. When we search multiple keywords for example “advanced...
Read more >
Highlight This: finds and marks words
Automatically finds and highlights words and phrases on the web page according to your list.
Read more >
Custom syntax highlighting for certain keywords (i.e. access ...
It's been 13 years and this issue is still open? What makes Jetbrains think this is not important (just curious)? Visual Studio code...
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