Skip to content

Conversation

@serkodev
Copy link
Collaborator

@serkodev serkodev commented Dec 11, 2025

Fix #2060

  • Replace the end with while in patterns.
    • end waits for one terminating match
    • while re-checks per line and drops the scope as soon as its condition fails.
  • Add extra rule to support single line <script>

Before

before

After

after

@serkodev
Copy link
Collaborator Author

serkodev commented Dec 11, 2025

Notice

  • If </script> is intended as a closing tag but does not appear at the beginning of a line, syntax highlighting will also break (though single-line <script> tags are not affected):
    <!-- bad -->
    <script setup lang="ts">
    const a = 1;</script>
    
    <!-- good -->
    <script setup lang="ts">const a = 1;</script>
    <script setup lang="ts">
    const a = 1;
    </script>
  • If </script> appears as a string and at the beginning of a line, syntax highlighting will break:
    <script setup lang="ts">
    const a = `
    </script> <- break
    `;
    </script>
    However, since </script> as a string currently is also not supported by @vuejs/core, so this issue has no impact.
    Ref: </script> in script block breaks SFC parsing core#7391

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Syntax highlighting requires new-line or semi-colon between script blocks.

2 participants