Skip to content

Commit

Permalink
vue: Support lang attribute for style tag injections (#19419)
Browse files Browse the repository at this point in the history
This PR adds support for injecting languages into `<style>` tags using
`<style lang="...">` in Vue.

Extracted from #18052.

Release Notes:

- N/A

Co-authored-by: Albert Marashi <[email protected]>
  • Loading branch information
2 people authored and mikayla-maki committed Oct 18, 2024
1 parent ab8150c commit bc6c474
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions extensions/vue/languages/vue/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,28 @@
(attribute_value) @content
(#set! "language" "typescript")))

; TODO: support less/sass/scss
; Vue <style lang="css"> injections
(style_element
(raw_text) @content
(#set! "language" "css"))
(start_tag
(attribute
(attribute_name) @_attr_name
(#eq? @_attr_name "lang")
(quoted_attribute_value
(attribute_value) @language
)
)
)
(raw_text) @content
)

; Vue <style> css injections (no lang attribute)
(style_element
(start_tag
(attribute
(attribute_name) @_attr_name
)*
)
(raw_text) @content
(#not-any-of? @_attr_name "lang")
(#set! language "css")
)

0 comments on commit bc6c474

Please sign in to comment.