Skip to content

syntax highlighting breaks when script tags export types without an empty line break #986

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

Closed
JessicaSachs opened this issue Feb 25, 2022 · 3 comments
Labels

Comments

@JessicaSachs
Copy link

Summary

When you export a type from a non-setup script block and do not add an empty line, the syntax highlighting breaks.

Pics

Screen Shot 2022-02-25 at 6 47 13 PM

Screen Shot 2022-02-25 at 6 47 21 PM

Steps to reproduce

Export a type from an SFC (it doesn't seem to fail when exporting constants, functions, or interfaces)

Broken Example

<script lang="ts">
export type foo = 1
</script>

<script setup lang="ts">
console.log('some stuff')
</script>

Workaround

<script lang="ts">
export type foo = 1

</script>

<script setup lang="ts">
console.log('some stuff')
</script>
@JessicaSachs JessicaSachs changed the title syntax highlighting breaks when script tags export types without an empty line below syntax highlighting breaks when script tags export types without an empty line break Feb 25, 2022
@JessicaSachs
Copy link
Author

Lol it seems to be an issue in the parser in general! The code example has the same problem :P

@johnsoncodehk
Copy link
Member

Thanks for the report :), this is embedded language syntax highlight issue, it's hard to change in volar (or maybe impossible), I personal use semicolon at line end so I can avoid it.

(Run editor.action.inspectTMScopes command to inspect it)
image

@c5n8
Copy link

c5n8 commented Mar 17, 2025

I noticed this issue has been marked as complete, but there’s no reference to an upstream issue. Could you provide a link to the relevant upstream discussion or fix? This would help with tracking progress and understanding how the issue was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants