-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
Reliable/reproducible error in a 'hello world' example using @codemirror/lang-html
when typing the final character to close a <script>
tag in certain situations.
#1476
Comments
This patch should help. |
That solved it, thank you! 🙏 |
Hey @marijnh looks like there might be an unhandled edge case. I tried my hardest to trim this down (from 3k+ lines), but the bug was really sensitive to removing random bits, so after about 30 minutes, this is what I got it down to:
If you scroll down to the bottom and try adding the final (Goes without saying, but this will produce invalid code, since |
FIX: Fix an issue where a `StreamLanguage` could get confused when trying to reuse existing parse data when the parsed range changed. codemirror/dev#1476
Thanks for reproducing that. Attached patch should cover this case. (I've updated the /try system to use URL fragments, not query parameters, to allow bigger scripts to be linked.) |
Thank you! 🙏 |
Describe the issue
In the reproduction link below, try typing
>
at the end of the first line to close the script tag. In the browser console you should see this error:But notice that if you delete everything from the text editor except
<script></script
and then try typing the final>
, then it works fine.So I guess it has something to do with the transition of the 'content' of the script tag (i.e. everything after
<script>
) during the transition from it no longer being considered part of the script tag, since the script tag was (about to be) closed at a position before it in the document.Thanks!
Browser and platform
Chrome, Ubuntu 22.04
Reproduction link
https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge1N0cmVhbUxhbmd1YWdlfSBmcm9tICJAY29kZW1pcnJvci9sYW5ndWFnZSI7CmltcG9ydCB7amF2YXNjcmlwdH0gZnJvbSAiQGNvZGVtaXJyb3IvbGVnYWN5LW1vZGVzL21vZGUvamF2YXNjcmlwdCI7CmltcG9ydCB7aHRtbH0gZnJvbSAiQGNvZGVtaXJyb3IvbGFuZy1odG1sIjsKCmxldCBqYXZhc2NyaXB0U3RyZWFtTGFuZ3VhZ2UgPSBTdHJlYW1MYW5ndWFnZS5kZ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HRvbTowO1xuICAgICAgICA8L2Rpdj5cbiAgICAgIDwvZGl2PlxuICAgIDwvZGl2PlxuICAgIFx4M0NzY3JpcHQ+XG4gICAgICBhKCk7XG4gICAgXHgzQy9zY3JpcHQ+XG4gICAgJywKICBleHRlbnNpb25zOiBbCiAgICBiYXNpY1NldHVwLAogICAgaHRtbExhbmd1YWdlRXh0ZW5zaW9uLAogIF0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5LAp9KTsK
The text was updated successfully, but these errors were encountered: