* feat(ecma): styled injection for css and keyframes

This commit is contained in:
Mark Skelton 2024-03-13 09:02:55 -05:00 committed by GitHub
parent 76f699dcc8
commit 35c1a32b26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,9 +17,12 @@
(#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#not-eq? @injection.language "svg"))
; Languages excluded from auto-injection due to special rules
; - svg uses the html parser
; - css uses the styled parser
(#not-any-of? @injection.language "svg" "css"))
; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query
; svg`...` or svg(`...`)
(call_expression
function:
((identifier) @_name
@ -57,6 +60,16 @@
((glimmer_template) @injection.content
(#set! injection.language "glimmer"))
; css`<css>`, keyframes`<css>`
(call_expression
function: (identifier) @_name
(#any-of? @_name "css" "keyframes")
arguments:
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div`<css>`
(call_expression
function: