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.

(Swift) Incorrect highlighting of raw strings

See original GitHub issue

[Editor: Dropping some notes for whoever picks this up]

This needs to also take into account:

  • SUBST (inline code) inside raw strings
  • the different forms of escaping inside raw strings
  • the different syntax of variable substitution (we should probably highlight this, right?)
  • extend the string markup tests quite a bit to go along with this
  • could we handle arbitrary number of #### with END_SAME_AS_BEGIN? Worth it?

The following is a single raw string:

##"Use #" and "# to delimit a raw string."##

However, it’s incorrectly highlighted as two separate strings. My guess is that highlight.js thinks the quotes in the middle close a string, then start a new one?

In general, the hashes around raw strings aren’t highlighted in the same color as the string, so perhaps raw strings aren’t supported at all yet?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
svanimpecommented, Dec 2, 2020

Just FYI: I’m picking this up again. Expect a pull request soon!

0reactions
joshgoebelcommented, Nov 2, 2020

Annoying, but doable if we’re only supporting a few specific variants… vs any number of ##### - which may not actually be possible given the contextual constraints you just mentioned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pure Bikeshedding: Raw Strings (why yes, again!) - Discussion
I believe \ would be far Swiftier than raw . It already carries the Swift connotation of escaping, in this case escaping the...
Read more >
Raw strings in Python break syntax highlighting : r/SublimeText
I believe raw strings are highlighted as regexes, so the \ is highlighted as escaping the following character.
Read more >
Swift - Split string over multiple lines - Stack Overflow
The problem w/that approach is you can easily reach too many 'continued' lines in Swift (as of Xcode 6.2 beta), where it complains...
Read more >
C# 11 Preview Updates - Raw string literals, UTF-8 and more!
“””;. So when I am inside the SQL raw string literal scope, VS can help us to recognize complex SQL syntax by Syntax...
Read more >
Prism
const Prism = require('prismjs'); // The code snippet you want to highlight, as a string const code = `var data = 1;`; //...
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