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 highlighting is broken with (nested?) template strings

See original GitHub issue

Hello,

I’ve just seen the announcement on Twitter, congrats!

I’ve tried looking at the latest sveltejs, and at approximately 1/3 of the file all the code is highlighted as a string.

Offending file: https://runpkg.com/?svelte@3.3.0/internal.js

Offending code:

const animation = node.style.animation || '';
node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`; 
// starting from the column everything is highlighted as a string

This is a very raw bug report, I literally heard about runpkg 5 minutes ago, so I made no further investigation. I hope this helps uncover a real bug somewhere!

End of report!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DjebbZcommented, May 15, 2019

Wow, that was fast. I don’t know another package that has nested string literals, I really stumbled upon this pattern by chance. Looks good on Svelte (I know it’s a bit late since you already merged).

Happy to have been helpful to the project. Cheers!

0reactions
VirtualDOMiniccommented, May 14, 2019

Ok, I lied. I think I have a fix!

Please see the relevant PR https://github.com/FormidableLabs/runpkg/pull/68

Would love for you to try it out and give feedback @DjebbZ . See the link to view the branch in the comment by now bot on that PR

Edit: @lukejacksonn and I are happy with the fix, and - evidently - prism are, too. Merged!

Read more comments on GitHub >

github_iconTop Results From Across the Web

I kinda don't get the whole "put html in template literals ...
I kinda don't get the whole "put html in template literals". Wouldn't there be no syntax highlighting? And the framework is either putting...
Read more >
Wrong syntax highlighting in TS/JS file with template strings in ...
The following construction is correctly starting the string, but not terminating it, and all the text after is written in red:
Read more >
How to define template strings in textmate language ...
I got this working by using special scopes from textmate language grammar:
Read more >
Syntax Highlight Guide | Visual Studio Code Extension API
A guide to syntax highlighting. ... Tokens are used for syntax highlighting, but also to classify the source code into areas of comments,...
Read more >
How to avoid broken formulas - Microsoft Support
You'll return to the cell with the broken formula, which will be in edit mode, and Excel will highlight the spot where it's...
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