-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedded JavaScript grammar can break the colorization #85
Comments
Hi @aeschli, do you know by any chance if this issue occurs with other applications besides VSCode which uses this html.tmbundle TextMate grammar? |
This is a rehash of #72, will leave this open for the moment as it might be good to look at the non-comment issues. Will post more about the comment problem in microsoft/vscode-textmate#49. |
This would reproduce in any editor using TM bundles if the exact same grammars are used for HTML and JavaScript. |
@infininight, @aeschli, @alexandrudima I think this issue can be corrected per my comment in microsoft/vscode-textmate#49. Looks like its about line 2937 in the PLIST file. This was pretty easy to trace down using vscode-textmate's INSPECT after I modified 'Grammar.ts' to enable the debug output of which expressions were being attempted. That should be made an option of say 'INSPECTDEEP' or something. :) |
@msftrncs Replied in other thread. |
@aeschli Do you have any tips on how you might recommend going about this? Are you talking about literally rewriting or copying a subset of the JavaScript grammar and inserting recognition of the end condition, or is there some shortcut or more efficient way to do this, like including specific repositories from an external grammar? I've tried doing things like this (in this example to embed the relevant portion of the CSS grammar into an HTML "patterns": [
{ "include": "source.css#rule-list" }
] Is there a correct way to do that and I'm just doing it wrong, or is it just not possible? The documentation on embedded grammars is pretty sparse. |
That's what I meant. The idea would be to simplify it, maybe just keywords, comments and literals. |
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 injs
.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>
tagThe text was updated successfully, but these errors were encountered: