codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 376 forks source link

JavaScript Template literals Highlight error when the expression is empty #1441

Closed hxj0x closed 2 months ago

hxj0x commented 2 months ago

Describe the issue

Although there are grammar errors, can we ensure that the grammar highlighting in this situation is also correct image

Browser and platform

No response

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICJjb25zdCBzdHIgPSBgc3RyaW5nIHRleHQgJHt9IHN0cmluZyB0ZXh0YFxuIiwKICBleHRlbnNpb25zOiBbYmFzaWNTZXR1cCwgamF2YXNjcmlwdCgpXSwKICBwYXJlbnQ6IGRvY3VtZW50LmJvZHkKfSkK

marijnh commented 2 months ago

I'm not sure you can call any highlighting for syntactically invalid input incorrect. But sure, attached patch makes this expression skippable.