From 35c1a32b267c969a024ef651c8a25d7ff9018d22 Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Wed, 13 Mar 2024 09:02:55 -0500 Subject: * feat(ecma): styled injection for `css` and `keyframes` --- queries/ecma/injections.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 00ff12c5a..011d953bf 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -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``, keyframes`` +(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`` (call_expression function: -- cgit v1.3.1