-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
export let x: Type
and type declaration without ending semicolon last in script block breaks syntax highlighting
#1970
Comments
This is an "issue" with the upstream TypeScript syntax highlight. But I can't find a situation where it will break inside a ts file. It was changed to be more precise in multiple lines type alias. But it breaks in vue, svelte and astro files. I am afraid there is not much we can do. |
Ok, so does upstream mean VS Code itself? Does this issue get propagated there or should I create a new bug report there (where ever that might be)? I have never seen this bug inside a pure It got worse with the latest VS Code update:
Before that only the |
Type alias without a semi also breaks highlight in a ts file. It's tracked here in #1110. About let without a semi, Yes, it is related to the script tag because it doesn't exist in a ts file. So We have a config file to define regex rules for VSCode to highlight the script tag section with TypeScirpt. But sometimes it seems like if one of the embed language matching rules hasn't ended, It won't consider top-level "</script>". So we either have to change TypeScript's highlight somehow to stop matching type annotation if there is a "</script>" or we'll have to find a way to force any TypeScript matching if there is a "</script>". We know this problem when it's still in beta. But I haven't found a way to work around it on our side yet. I don't think this will be fixed anytime soon. You can work around it with a comment or an empty line afterwards. |
same issue here, without semi, syntax crashing happens anywhere. AstroJs has same problems too. i think those problems might be related vscode's side. |
Seems to have been fixed now, but I don't know how to update 😆 |
Once it's merged into VSCode main, You can test it with VSCode insider. Or you can try it with the TypeScript nightly extension for the nightly release of TSServer and TypeScript-TmLanguage. I tested it, and it seems to be fixed yesterday by another commit. A by-product of other TypeScript statements 😆. |
Is this still an issue for people? I think this is fixed in vscode 1.77.1. If confirmed this could be closed, I suppose? |
It's fixed by another issue other than the linked one, and it's only in the TypeScript nightly extension now. |
This seems to be fixed in the latest VS Code, so I'm all good 👍 (And thanks for all the good work you guys do 🤩) |
Reopening for visibility. Let's close this when it is fixed in VSCode stable. It should be fixed in a few days in VSCode 1.78. |
Fixed in VSCode 1.78 |
Describe the bug
When running Typescript mode and you have either an
export let varName: Type
, ortype Type = type
without a line-ending semicolon last in a script block, the syntax highlighting breaks.The problem with type declarations I've seen for ages, but the problem with component properties arrived yesterday after updating VS Code.
I think the screenshots are quite explanatory.
Syntax highlight breaks after ZeRow
Syntax highlighting breaks after the ending curly brace for type declaration
Test
Syntax highlight works when ending type declaration with a semicolon
Syntax highlighting works when ending property declaration with semicolon
Syntax highlighting works when ending script block with some other statement or expression
Reproduction
This simple snippet is sufficient to to reproduce the bug.
Expected behaviour
I expect the ending
</script>
tag to be correctly highlightedSystem Info
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: