html.tmbundle icon indicating copy to clipboard operation
html.tmbundle copied to clipboard

Embedded JavaScript grammar can break the colorization

Open aeschli opened this issue 6 years ago • 7 comments

The following code doesn't highlight correctly in VSCode after //</script>. The problem is that the embedded JavaScript grammar consumes the full //</script> and the sourrounding html rule doesn't end. The grammar is stuck in js.

<!DOCTYPE html>
<html>
<head>
    <script>
        //</script>
</head>
<body>

</body>
</html>

There are many similar issues when the JS code is not complete and the JavaScript grammar is in the middle of some rule.

IMO the best thing would be to not include the full blown JavaScript grammar but embed a (simplified) variant that is aware of the </script> tag

aeschli avatar Jun 01 '18 07:06 aeschli