withastro/astro

🐛 BUG: SASS content incorrectly highlighted as CSS syntax when `lang='sass'` is not on the same line with `<style`

Offen

#14.657 geöffnet am 17.01.2025

 (14 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (3.732 Forks)batch import
- P2: has workaroundfeat: syntaxgood first issuepkg: language-toolstriage: needs triage

Repository-Metriken

Stars
 (61.918 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 4T 23h) (197 gemergte PRs in 30 T)

Beschreibung

Describe the Bug

When the lang attribute of the <style> tag is not on the same line as the style tag, the content may be incorrectly highlighted as CSS syntax.

Steps to Reproduce

  1. npm create astro@latest
  2. open the project in vscode
  3. install newest astro extension
  4. create anyname.astro with the contents
<style
  lang="sass"
  define:vars={{
    // any comment to avoid formatter collapse content into a single line
    foo: '#fff',
  }}
>
  .bar
    color: var(--foo)
</style>
  1. the content below .bar (include </style>) will be incorrectly highlighted as css syntax, not sass.

Link to Minimal Reproducible Example

https://gist.github.com/HPCesia/6e935433cfd6e414099f71714cb4961d

Contributor Guide