mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
* feat(ecma): styled injection for css and keyframes
This commit is contained in:
parent
76f699dcc8
commit
35c1a32b26
1 changed files with 15 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue