Open tomsarry opened 10 months ago
{
className: 'string',
variants: [
{ begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ },
{ begin: /b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/ }
]
},
I'm guessing .
doesn't cover Emoji... I'd have to play around with this one...
Would using |\p{Extended_Pictographic}
be acceptable?
Quick checks seem to make it work.
I talked a bit too fast, the pattern above does not work either (I think :sparkles: is encoded using only one codepoint, the problem seems to be for characters encoded with 2 codepoints). After looking at the char implementation, the following are also valid but not matched by the expression above:
'\u{10ffff}'
'\u{FFFD}'
🥰
(actually, most unicode emojis seem to fail)'𝕊'
I really am not a regex expert, but I found the following matches for emojis / unicode characters, this might be of some help:
Describe the issue In rust, single quotes around an emoji are not colored properly. However, autodetect (on csharp) successfully colors it.
Which language seems to have the issue? Rust
Are you using
highlight
orhighlightAuto
?highlight
Sample Code to Reproduce https://jsfiddle.net/cawyx173/
rust, coloring doesn't work
autodetect (csharp), works
Expected behavior When using rust highlighting, single quotes around an emoji should have the same color as single quotes around any other character.
Additional context Syntax highlighting works properly using double quotes around emojis. Problem seen in rust book.