You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Embedded JavaScript grammar can break the colorization #85
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.
changed the title [-]Html script closing-tag not detected when occurs immediately after 2 slashes[/-][+]Embedded JavaScript grammar can break the colorization[/+]on Jun 1, 2018
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 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. :)
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 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 style attribute), but without any luck:
Are you talking about literally rewriting or copying a subset of the JavaScript grammar and inserting recognition of the end condition
That's what I meant. The idea would be to simplify it, maybe just keywords, comments and literals.
That means duplication of some rules, but gives full control and avoids dependencies
Activity
[-]Html script closing-tag not detected when occurs immediately after 2 slashes[/-][+]Embedded JavaScript grammar can break the colorization[/+]SDP190 commentedon Jun 1, 2018
Hi @aeschli, do you know by any chance if this issue occurs with other applications besides VSCode which uses this html.tmbundle TextMate grammar?
infininight commentedon Jun 1, 2018
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.
alexdima commentedon Jun 11, 2018
This would reproduce in any editor using TM bundles if the exact same grammars are used for HTML and JavaScript.
msftrncs commentedon Sep 20, 2018
@infininight, @aeschli, @alexandrudima
I think this issue can be corrected per my comment in microsoft/vscode-textmate#49.
microsoft/vscode-textmate#49 (comment)
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. :)
infininight commentedon Sep 20, 2018
@msftrncs Replied in other thread.
dannymcgee commentedon Jan 18, 2020
@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
styleattribute), but without any luck: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.
aeschli commentedon Jan 21, 2020
That's what I meant. The idea would be to simplify it, maybe just keywords, comments and literals.
That means duplication of some rules, but gives full control and avoids dependencies