Skip to content

Commit

Permalink
Support lang attribute for style tag injections (zed-industries/z…
Browse files Browse the repository at this point in the history
…ed#19419)

This PR adds support for injecting languages into `<style>` tags using
`<style lang="...">` in Vue.

Extracted from zed-industries/zed#18052.

Release Notes:

- N/A

Co-authored-by: Albert Marashi <[email protected]>
  • Loading branch information
maxdeviant and AlbertMarashi authored Oct 18, 2024
1 parent 32ce5cf commit 205b377
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions 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 205b377

Please sign in to comment.