summaryrefslogtreecommitdiff
path: root/runtime/queries/vue/injections.scm
blob: 1b053e748d3f5496800b770216e78ffb32e7b10d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(directive_attribute
  (directive_name) @keyword
  (quoted_attribute_value
    (attribute_value) @injection.content)
 (#set! injection.language "javascript"))

((interpolation
  (raw_text) @injection.content)
 (#set! injection.language "javascript"))

; <script>
((script_element
    (start_tag) @_no_lang
    (raw_text) @injection.content)
  (#not-match? @_no_lang "lang=")
  (#set! injection.language "javascript"))

; <script lang="...">
((script_element
  (start_tag
    (attribute
    (attribute_name) @_attr_name
    (quoted_attribute_value (attribute_value) @injection.language)))
  (raw_text) @injection.content)
  (#eq? @_attr_name "lang"))

; <style>
((style_element
    (start_tag) @_no_lang
    (raw_text) @injection.content)
  (#not-match? @_no_lang "lang=")
  (#set! injection.language "css"))

; <style lang="...">
((style_element
  (start_tag
    (attribute
      (attribute_name) @_attr_name
      (quoted_attribute_value (attribute_value) @injection.language)))
   (raw_text) @injection.content)
 (#eq? @_attr_name "lang"))

((comment) @injection.content
 (#set! injection.language "comment"))