vue: Support lang
attribute for style
tag injections (#19419)
This PR adds support for injecting languages into `<style>` tags using `<style lang="...">` in Vue. Extracted from https://github.com/zed-industries/zed/pull/18052. Release Notes: - N/A Co-authored-by: Albert Marashi <albert@lumina.earth>
This commit is contained in:
parent
5508832ba6
commit
6f24c1da79
1 changed files with 24 additions and 3 deletions
|
@ -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")
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue