Closed kentcdodds closed 3 years ago
Hey Kent! Taking a look at this now. For some context, this issue (and ones like it) tend to get a bit hairy because this package is an "all-in-one" solution for what VSCode splits into "javascript" and "javascriptreact".
As an example, the code in test.html works without semicolons, but the snippet from your issue does not. Syntax highlighting is fun!
<html>
<title>Title</title>
<lang>en</lang>
<body></body>
<script>
const rootElement = document.createElement('div')
rootElement.id = 'root'
document.body.append(rootElement)
const helloWorldElement = document.createElement('div')
helloWorldElement.textContent = 'Hello World'
rootElement.append(helloWorldElement)
</script>
</html>
Putting a pin in this for now, so using this thread for note-taking. The following simple cases seem to break the highlighting.:
<script>
let foo
</script>
<script>
foo.bar()
</script>
Like I mentioned, debugging this is pretty difficult, but narrowing it down to these cases is a start. There's an issue with a regex somewhere, it's just a matter of tracking it down.
Try out 0.0.35 Kent. The changes I made may have some side effects, but it looks good in my testing.
Thanks! After disabling this extension for a while I actually realized I'm not sure I need this extension anymore 😅 But if I decide I do I'll try this out and let you know. Thanks Michael!
All the info you need is in this issue: https://github.com/microsoft/vscode/issues/121577
I'll just copy over the contents of this comment:
Looks like it's exactly the same as my other screenshot.
What I find interesting is when I put my cursor on the closing
</script>
html tag or even the</html>
, it incorrectly identifies language as "JavaScript"However, if I add a semicolon, it correctly identifies it as HTML:
I would expect it to be able to identify it as the correct language regardless of the presence of the semicolon.
Once I switched off this plugin I no longer had these problems: