injections.scm

  1(((comment) @_jsdoc_comment
  2  (#match? @_jsdoc_comment "(?s)^/[*][*][^*].*[*]/$")) @injection.content
  3  (#set! injection.language "jsdoc"))
  4
  5(((comment) @_reference
  6  (#match? @_reference "^///\\s+<reference\\s+types=\"\\S+\"\\s*/>\\s*$")) @injection.content
  7  (#set! injection.language "html"))
  8
  9((regex) @injection.content
 10  (#set! injection.language "regex"))
 11
 12(call_expression
 13  function: (identifier) @_name (#eq? @_name "css")
 14  arguments: (template_string (string_fragment) @injection.content
 15                              (#set! injection.language "css"))
 16)
 17
 18(call_expression
 19  function: (member_expression
 20    object: (identifier) @_obj (#eq? @_obj "styled")
 21    property: (property_identifier))
 22  arguments: (template_string (string_fragment) @injection.content
 23                              (#set! injection.language "css"))
 24)
 25
 26(call_expression
 27  function: (call_expression
 28    function: (identifier) @_name (#eq? @_name "styled"))
 29  arguments: (template_string (string_fragment) @injection.content
 30                              (#set! injection.language "css"))
 31)
 32
 33(call_expression
 34  function: (identifier) @_name (#eq? @_name "html")
 35  arguments: (template_string) @injection.content
 36                              (#set! injection.language "html")
 37)
 38
 39(call_expression
 40  function: (identifier) @_name (#eq? @_name "js")
 41  arguments: (template_string (string_fragment) @injection.content
 42                              (#set! injection.language "javascript"))
 43)
 44
 45(call_expression
 46  function: (identifier) @_name (#eq? @_name "json")
 47  arguments: (template_string (string_fragment) @injection.content
 48                              (#set! injection.language "json"))
 49)
 50
 51(call_expression
 52  function: (identifier) @_name (#eq? @_name "sql")
 53  arguments: (template_string (string_fragment) @injection.content
 54                              (#set! injection.language "sql"))
 55)
 56
 57(call_expression
 58  function: (identifier) @_name (#eq? @_name "ts")
 59  arguments: (template_string (string_fragment) @injection.content
 60                              (#set! injection.language "typescript"))
 61)
 62
 63(call_expression
 64  function: (identifier) @_name (#match? @_name "^ya?ml$")
 65  arguments: (template_string (string_fragment) @injection.content
 66                              (#set! injection.language "yaml"))
 67)
 68
 69(call_expression
 70  function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
 71  arguments: (template_string (string_fragment) @injection.content
 72                              (#set! injection.language "graphql"))
 73)
 74
 75(call_expression
 76  function: (identifier) @_name (#match? @_name "^g(raph)?ql$")
 77  arguments: (arguments (template_string (string_fragment) @injection.content
 78                              (#set! injection.language "graphql")))
 79)
 80
 81(call_expression
 82  function: (identifier) @_name(#match? @_name "^iso$")
 83  arguments: (arguments (template_string (string_fragment) @injection.content
 84                              (#set! injection.language "isograph")))
 85)
 86
 87;; Angular Component template injection
 88(call_expression
 89  function: [
 90    (identifier) @_decorator (#eq? @_decorator "Component")
 91    (member_expression property: (property_identifier) @_decorator (#eq? @_decorator "Component"))
 92  ]
 93  arguments: (arguments (object
 94    (pair
 95      key: (property_identifier) @_prop (#eq? @_prop "template")
 96      value: [
 97        (string) @injection.content
 98        (template_string) @injection.content
 99        (template_string (string_fragment) @injection.content)
100      ]
101    )))
102  (#set! injection.language "angular"))
103
104;; Angular Component styles injection
105(call_expression
106  function: [
107    (identifier) @_decorator (#eq? @_decorator "Component")
108    (member_expression property: (property_identifier) @_decorator (#eq? @_decorator "Component"))
109  ]
110  arguments: (arguments (object
111    (pair
112      key: (property_identifier) @_prop (#eq? @_prop "styles")
113      value: [
114        (string) @injection.content
115        (template_string) @injection.content
116        (template_string (string_fragment) @injection.content)
117        (array (string) @injection.content)
118        (array (template_string) @injection.content)
119        (array (template_string (string_fragment)) @injection.content)
120      ]
121    )))
122  (#set! injection.language "css"))