(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:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just FYI: I’m picking this up again. Expect a pull request soon!
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.