react-native-codepad-lang-javascript 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,863 @@
1
+ package me.sectiontn.codepad.lang.javascript
2
+
3
+ import me.sectiontn.codepad.syntax.LanguageProvider
4
+
5
+ class JavascriptLanguage : LanguageProvider {
6
+ override val id: String = "javascript"
7
+ override val languagePointer: Long get() = nativeLanguage()
8
+ override val highlights: String = HIGHLIGHTS
9
+ override val injections: String = INJECTIONS
10
+
11
+ private external fun nativeLanguage(): Long
12
+
13
+ companion object {
14
+ init {
15
+ System.loadLibrary("codepad_lang_javascript")
16
+ }
17
+
18
+ private val HIGHLIGHTS: String = """; inherited from ecma
19
+ ; Types
20
+ ; Javascript
21
+ ; Variables
22
+ ;-----------
23
+ (identifier) @variable
24
+
25
+ ; Properties
26
+ ;-----------
27
+ (property_identifier) @variable.member
28
+
29
+ (shorthand_property_identifier) @variable.member
30
+
31
+ (private_property_identifier) @variable.member
32
+
33
+ (object_pattern
34
+ (shorthand_property_identifier_pattern) @variable)
35
+
36
+ (object_pattern
37
+ (object_assignment_pattern
38
+ (shorthand_property_identifier_pattern) @variable))
39
+
40
+ ; Special identifiers
41
+ ;--------------------
42
+ ((identifier) @type
43
+ (#match? @type "^[A-Z]"))
44
+
45
+ ((identifier) @constant
46
+ (#match? @constant "^_*[A-Z][A-Z0-9_]*${'$'}"))
47
+
48
+ ((shorthand_property_identifier) @constant
49
+ (#match? @constant "^_*[A-Z][A-Z0-9_]*${'$'}"))
50
+
51
+ ((identifier) @variable.builtin
52
+ (#any-of? @variable.builtin "arguments" "module" "console" "window" "document"))
53
+
54
+ ((identifier) @type.builtin
55
+ (#any-of? @type.builtin
56
+ "Object" "Function" "Boolean" "Symbol" "Number" "Math" "Date" "String" "RegExp" "Map" "Set"
57
+ "WeakMap" "WeakSet" "Promise" "Array" "Int8Array" "Uint8Array" "Uint8ClampedArray" "Int16Array"
58
+ "Uint16Array" "Int32Array" "Uint32Array" "Float32Array" "Float64Array" "ArrayBuffer" "DataView"
59
+ "Error" "EvalError" "InternalError" "RangeError" "ReferenceError" "SyntaxError" "TypeError"
60
+ "URIError"))
61
+
62
+ (statement_identifier) @label
63
+
64
+ ; Function and method definitions
65
+ ;--------------------------------
66
+ (function_expression
67
+ name: (identifier) @function)
68
+
69
+ (function_declaration
70
+ name: (identifier) @function)
71
+
72
+ (generator_function
73
+ name: (identifier) @function)
74
+
75
+ (generator_function_declaration
76
+ name: (identifier) @function)
77
+
78
+ (method_definition
79
+ name: [
80
+ (property_identifier)
81
+ (private_property_identifier)
82
+ ] @function.method)
83
+
84
+ (method_definition
85
+ name: (property_identifier) @constructor
86
+ (#eq? @constructor "constructor"))
87
+
88
+ (pair
89
+ key: (property_identifier) @function.method
90
+ value: (function_expression))
91
+
92
+ (pair
93
+ key: (property_identifier) @function.method
94
+ value: (arrow_function))
95
+
96
+ (assignment_expression
97
+ left: (member_expression
98
+ property: (property_identifier) @function.method)
99
+ right: (arrow_function))
100
+
101
+ (assignment_expression
102
+ left: (member_expression
103
+ property: (property_identifier) @function.method)
104
+ right: (function_expression))
105
+
106
+ (variable_declarator
107
+ name: (identifier) @function
108
+ value: (arrow_function))
109
+
110
+ (variable_declarator
111
+ name: (identifier) @function
112
+ value: (function_expression))
113
+
114
+ (assignment_expression
115
+ left: (identifier) @function
116
+ right: (arrow_function))
117
+
118
+ (assignment_expression
119
+ left: (identifier) @function
120
+ right: (function_expression))
121
+
122
+ ; Function and method calls
123
+ ;--------------------------
124
+ (call_expression
125
+ function: (identifier) @function.call)
126
+
127
+ (call_expression
128
+ function: (member_expression
129
+ property: [
130
+ (property_identifier)
131
+ (private_property_identifier)
132
+ ] @function.method.call))
133
+
134
+ (call_expression
135
+ function: (await_expression
136
+ (identifier) @function.call))
137
+
138
+ (call_expression
139
+ function: (await_expression
140
+ (member_expression
141
+ property: [
142
+ (property_identifier)
143
+ (private_property_identifier)
144
+ ] @function.method.call)))
145
+
146
+ ; Builtins
147
+ ;---------
148
+ ((identifier) @module.builtin
149
+ (#eq? @module.builtin "Intl"))
150
+
151
+ ((identifier) @function.builtin
152
+ (#any-of? @function.builtin
153
+ "eval" "isFinite" "isNaN" "parseFloat" "parseInt" "decodeURI" "decodeURIComponent" "encodeURI"
154
+ "encodeURIComponent" "require"))
155
+
156
+ ; Constructor
157
+ ;------------
158
+ (new_expression
159
+ constructor: (identifier) @constructor)
160
+
161
+ ; Decorators
162
+ ;----------
163
+ (decorator
164
+ "@" @attribute
165
+ (identifier) @attribute)
166
+
167
+ (decorator
168
+ "@" @attribute
169
+ (call_expression
170
+ (identifier) @attribute))
171
+
172
+ (decorator
173
+ "@" @attribute
174
+ (member_expression
175
+ (property_identifier) @attribute))
176
+
177
+ (decorator
178
+ "@" @attribute
179
+ (call_expression
180
+ (member_expression
181
+ (property_identifier) @attribute)))
182
+
183
+ ; Literals
184
+ ;---------
185
+ [
186
+ (this)
187
+ (super)
188
+ ] @variable.builtin
189
+
190
+ ((identifier) @variable.builtin
191
+ (#eq? @variable.builtin "self"))
192
+
193
+ [
194
+ (true)
195
+ (false)
196
+ ] @boolean
197
+
198
+ [
199
+ (null)
200
+ (undefined)
201
+ ] @constant.builtin
202
+
203
+ [
204
+ (comment)
205
+ (html_comment)
206
+ ] @comment @spell
207
+
208
+ ((comment) @comment.documentation
209
+ (#match? @comment.documentation "^/[*][*][^*].*[*]/${'$'}"))
210
+
211
+ (hash_bang_line) @keyword.directive
212
+
213
+ ((string_fragment) @keyword.directive
214
+ (#eq? @keyword.directive "use strict"))
215
+
216
+ (string) @string
217
+
218
+ (template_string) @string
219
+
220
+ (escape_sequence) @string.escape
221
+
222
+ (regex_pattern) @string.regexp
223
+
224
+ (regex_flags) @character.special
225
+
226
+ (regex
227
+ "/" @punctuation.bracket) ; Regex delimiters
228
+
229
+ (number) @number
230
+
231
+ ((identifier) @number
232
+ (#any-of? @number "NaN" "Infinity"))
233
+
234
+ ; Punctuation
235
+ ;------------
236
+ [
237
+ ";"
238
+ "."
239
+ ","
240
+ ":"
241
+ ] @punctuation.delimiter
242
+
243
+ [
244
+ "--"
245
+ "-"
246
+ "-="
247
+ "&&"
248
+ "+"
249
+ "++"
250
+ "+="
251
+ "&="
252
+ "/="
253
+ "**="
254
+ "<<="
255
+ "<"
256
+ "<="
257
+ "<<"
258
+ "="
259
+ "=="
260
+ "==="
261
+ "!="
262
+ "!=="
263
+ "=>"
264
+ ">"
265
+ ">="
266
+ ">>"
267
+ "||"
268
+ "%"
269
+ "%="
270
+ "*"
271
+ "**"
272
+ ">>>"
273
+ "&"
274
+ "|"
275
+ "^"
276
+ "??"
277
+ "*="
278
+ ">>="
279
+ ">>>="
280
+ "^="
281
+ "|="
282
+ "&&="
283
+ "||="
284
+ "??="
285
+ "..."
286
+ ] @operator
287
+
288
+ (binary_expression
289
+ "/" @operator)
290
+
291
+ (ternary_expression
292
+ [
293
+ "?"
294
+ ":"
295
+ ] @keyword.conditional.ternary)
296
+
297
+ (unary_expression
298
+ [
299
+ "!"
300
+ "~"
301
+ "-"
302
+ "+"
303
+ ] @operator)
304
+
305
+ (unary_expression
306
+ [
307
+ "delete"
308
+ "void"
309
+ ] @keyword.operator)
310
+
311
+ [
312
+ "("
313
+ ")"
314
+ "["
315
+ "]"
316
+ "{"
317
+ "}"
318
+ ] @punctuation.bracket
319
+
320
+ (template_substitution
321
+ [
322
+ "${'$'}{"
323
+ "}"
324
+ ] @punctuation.special) @none
325
+
326
+ ; Imports
327
+ ;----------
328
+ (namespace_import
329
+ "*" @character.special
330
+ (identifier) @module)
331
+
332
+ (namespace_export
333
+ "*" @character.special
334
+ (identifier) @module)
335
+
336
+ (export_statement
337
+ "*" @character.special)
338
+
339
+ ; Keywords
340
+ ;----------
341
+ [
342
+ "if"
343
+ "else"
344
+ "switch"
345
+ "case"
346
+ ] @keyword.conditional
347
+
348
+ [
349
+ "import"
350
+ "from"
351
+ "as"
352
+ "export"
353
+ ] @keyword.import
354
+
355
+ [
356
+ "for"
357
+ "of"
358
+ "do"
359
+ "while"
360
+ "continue"
361
+ ] @keyword.repeat
362
+
363
+ [
364
+ "break"
365
+ "const"
366
+ "debugger"
367
+ "extends"
368
+ "get"
369
+ "let"
370
+ "set"
371
+ "static"
372
+ "target"
373
+ "var"
374
+ "with"
375
+ ] @keyword
376
+
377
+ "class" @keyword.type
378
+
379
+ [
380
+ "async"
381
+ "await"
382
+ ] @keyword.coroutine
383
+
384
+ [
385
+ "return"
386
+ "yield"
387
+ ] @keyword.return
388
+
389
+ "function" @keyword.function
390
+
391
+ [
392
+ "new"
393
+ "delete"
394
+ "in"
395
+ "instanceof"
396
+ "typeof"
397
+ ] @keyword.operator
398
+
399
+ [
400
+ "throw"
401
+ "try"
402
+ "catch"
403
+ "finally"
404
+ ] @keyword.exception
405
+
406
+ (export_statement
407
+ "default" @keyword)
408
+
409
+ (switch_default
410
+ "default" @keyword.conditional)
411
+
412
+ ; inherited from jsx
413
+ (jsx_element
414
+ open_tag: (jsx_opening_element
415
+ [
416
+ "<"
417
+ ">"
418
+ ] @tag.delimiter))
419
+
420
+ (jsx_element
421
+ close_tag: (jsx_closing_element
422
+ [
423
+ "</"
424
+ ">"
425
+ ] @tag.delimiter))
426
+
427
+ (jsx_self_closing_element
428
+ [
429
+ "<"
430
+ "/>"
431
+ ] @tag.delimiter)
432
+
433
+ (jsx_attribute
434
+ (property_identifier) @tag.attribute)
435
+
436
+ (jsx_opening_element
437
+ name: (identifier) @tag.builtin)
438
+
439
+ (jsx_closing_element
440
+ name: (identifier) @tag.builtin)
441
+
442
+ (jsx_self_closing_element
443
+ name: (identifier) @tag.builtin)
444
+
445
+ (jsx_opening_element
446
+ ((identifier) @tag
447
+ (#match? @tag "^[A-Z]")))
448
+
449
+ ; Handle the dot operator effectively - <My.Component>
450
+ (jsx_opening_element
451
+ (member_expression
452
+ (identifier) @tag.builtin
453
+ (property_identifier) @tag))
454
+
455
+ (jsx_closing_element
456
+ ((identifier) @tag
457
+ (#match? @tag "^[A-Z]")))
458
+
459
+ ; Handle the dot operator effectively - </My.Component>
460
+ (jsx_closing_element
461
+ (member_expression
462
+ (identifier) @tag.builtin
463
+ (property_identifier) @tag))
464
+
465
+ (jsx_self_closing_element
466
+ ((identifier) @tag
467
+ (#match? @tag "^[A-Z]")))
468
+
469
+ ; Handle the dot operator effectively - <My.Component />
470
+ (jsx_self_closing_element
471
+ (member_expression
472
+ (identifier) @tag.builtin
473
+ (property_identifier) @tag))
474
+
475
+ (html_character_reference) @tag
476
+
477
+ (jsx_text) @none @spell
478
+
479
+ (html_character_reference) @character.special
480
+
481
+ ((jsx_element
482
+ (jsx_opening_element
483
+ name: (identifier) @_tag)
484
+ (jsx_text) @markup.heading)
485
+ (#eq? @_tag "title"))
486
+
487
+ ((jsx_element
488
+ (jsx_opening_element
489
+ name: (identifier) @_tag)
490
+ (jsx_text) @markup.heading.1)
491
+ (#eq? @_tag "h1"))
492
+
493
+ ((jsx_element
494
+ (jsx_opening_element
495
+ name: (identifier) @_tag)
496
+ (jsx_text) @markup.heading.2)
497
+ (#eq? @_tag "h2"))
498
+
499
+ ((jsx_element
500
+ (jsx_opening_element
501
+ name: (identifier) @_tag)
502
+ (jsx_text) @markup.heading.3)
503
+ (#eq? @_tag "h3"))
504
+
505
+ ((jsx_element
506
+ (jsx_opening_element
507
+ name: (identifier) @_tag)
508
+ (jsx_text) @markup.heading.4)
509
+ (#eq? @_tag "h4"))
510
+
511
+ ((jsx_element
512
+ (jsx_opening_element
513
+ name: (identifier) @_tag)
514
+ (jsx_text) @markup.heading.5)
515
+ (#eq? @_tag "h5"))
516
+
517
+ ((jsx_element
518
+ (jsx_opening_element
519
+ name: (identifier) @_tag)
520
+ (jsx_text) @markup.heading.6)
521
+ (#eq? @_tag "h6"))
522
+
523
+ ((jsx_element
524
+ (jsx_opening_element
525
+ name: (identifier) @_tag)
526
+ (jsx_text) @markup.strong)
527
+ (#any-of? @_tag "strong" "b"))
528
+
529
+ ((jsx_element
530
+ (jsx_opening_element
531
+ name: (identifier) @_tag)
532
+ (jsx_text) @markup.italic)
533
+ (#any-of? @_tag "em" "i"))
534
+
535
+ ((jsx_element
536
+ (jsx_opening_element
537
+ name: (identifier) @_tag)
538
+ (jsx_text) @markup.strikethrough)
539
+ (#any-of? @_tag "s" "del"))
540
+
541
+ ((jsx_element
542
+ (jsx_opening_element
543
+ name: (identifier) @_tag)
544
+ (jsx_text) @markup.underline)
545
+ (#eq? @_tag "u"))
546
+
547
+ ((jsx_element
548
+ (jsx_opening_element
549
+ name: (identifier) @_tag)
550
+ (jsx_text) @markup.raw)
551
+ (#any-of? @_tag "code" "kbd"))
552
+
553
+ ((jsx_element
554
+ (jsx_opening_element
555
+ name: (identifier) @_tag)
556
+ (jsx_text) @markup.link.label)
557
+ (#eq? @_tag "a"))
558
+
559
+ ((jsx_attribute
560
+ (property_identifier) @_attr
561
+ (string
562
+ (string_fragment) @string.special.url))
563
+ (#any-of? @_attr "href" "src"))
564
+
565
+ ((jsx_element) @_jsx_element
566
+ (#set! @_jsx_element bo.commentstring "{/* %s */}"))
567
+
568
+ ((jsx_attribute) @_jsx_attribute
569
+ (#set! @_jsx_attribute bo.commentstring "// %s"))
570
+
571
+
572
+ ; Parameters
573
+ (formal_parameters
574
+ (identifier) @variable.parameter)
575
+
576
+ (formal_parameters
577
+ (rest_pattern
578
+ (identifier) @variable.parameter))
579
+
580
+ ; ({ a }) => null
581
+ (formal_parameters
582
+ (object_pattern
583
+ (shorthand_property_identifier_pattern) @variable.parameter))
584
+
585
+ ; ({ a = b }) => null
586
+ (formal_parameters
587
+ (object_pattern
588
+ (object_assignment_pattern
589
+ (shorthand_property_identifier_pattern) @variable.parameter)))
590
+
591
+ ; ({ a: b }) => null
592
+ (formal_parameters
593
+ (object_pattern
594
+ (pair_pattern
595
+ value: (identifier) @variable.parameter)))
596
+
597
+ ; ([ a ]) => null
598
+ (formal_parameters
599
+ (array_pattern
600
+ (identifier) @variable.parameter))
601
+
602
+ ; ({ a } = { a }) => null
603
+ (formal_parameters
604
+ (assignment_pattern
605
+ (object_pattern
606
+ (shorthand_property_identifier_pattern) @variable.parameter)))
607
+
608
+ ; ({ a = b } = { a }) => null
609
+ (formal_parameters
610
+ (assignment_pattern
611
+ (object_pattern
612
+ (object_assignment_pattern
613
+ (shorthand_property_identifier_pattern) @variable.parameter))))
614
+
615
+ ; a => null
616
+ (arrow_function
617
+ parameter: (identifier) @variable.parameter)
618
+
619
+ ; optional parameters
620
+ (formal_parameters
621
+ (assignment_pattern
622
+ left: (identifier) @variable.parameter))
623
+
624
+ ; punctuation
625
+ (optional_chain) @punctuation.delimiter
626
+ """
627
+ private val INJECTIONS: String = """; inherited from ecma
628
+ (((comment) @_jsdoc_comment
629
+ (#match? @_jsdoc_comment "^/[*][*][^*].*[*]/${'$'}")) @injection.content
630
+ (#set! injection.language "jsdoc"))
631
+
632
+ ((comment) @injection.content
633
+ (#set! injection.language "comment"))
634
+
635
+ ; html(`...`), html`...`, sql(`...`), etc.
636
+ (call_expression
637
+ function: (identifier) @injection.language
638
+ arguments: [
639
+ (arguments
640
+ (template_string) @injection.content)
641
+ (template_string) @injection.content
642
+ ]
643
+ (#match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*${'$'}")
644
+ (#offset! @injection.content 0 1 0 -1)
645
+ (#set! injection.include-children)
646
+ ; Languages excluded from auto-injection due to special rules
647
+ ; - svg uses the html parser
648
+ ; - css uses the styled parser
649
+ (#not-any-of? @injection.language "svg" "css"))
650
+
651
+ ; svg`...` or svg(`...`)
652
+ (call_expression
653
+ function: (identifier) @_name
654
+ (#eq? @_name "svg")
655
+ arguments: [
656
+ (arguments
657
+ (template_string) @injection.content)
658
+ (template_string) @injection.content
659
+ ]
660
+ (#offset! @injection.content 0 1 0 -1)
661
+ (#set! injection.include-children)
662
+ (#set! injection.language "html"))
663
+
664
+ ; Vercel PostgreSQL
665
+ ; foo.sql`...` or foo.sql(`...`)
666
+ (call_expression
667
+ function: (member_expression
668
+ property: (property_identifier) @injection.language)
669
+ arguments: [
670
+ (arguments
671
+ (template_string) @injection.content)
672
+ (template_string) @injection.content
673
+ ]
674
+ (#eq? @injection.language "sql")
675
+ (#offset! @injection.content 0 1 0 -1)
676
+ (#set! injection.include-children))
677
+
678
+ ; Sanity CMS GROQ query
679
+ ; defineQuery(`...`)
680
+ (call_expression
681
+ function: (identifier) @_name
682
+ (#eq? @_name "defineQuery")
683
+ arguments: (arguments
684
+ (template_string) @injection.content)
685
+ (#offset! @injection.content 0 1 0 -1)
686
+ (#set! injection.include-children)
687
+ (#set! injection.language "groq"))
688
+
689
+ ; gql`...` or gql(`...`)
690
+ (call_expression
691
+ function: (identifier) @_name
692
+ (#eq? @_name "gql")
693
+ arguments: [
694
+ (arguments
695
+ (template_string) @injection.content)
696
+ (template_string) @injection.content
697
+ ]
698
+ (#offset! @injection.content 0 1 0 -1)
699
+ (#set! injection.include-children)
700
+ (#set! injection.language "graphql"))
701
+
702
+ (call_expression
703
+ function: (identifier) @_name
704
+ (#eq? @_name "hbs")
705
+ arguments: (template_string) @injection.content
706
+ (#offset! @injection.content 0 1 0 -1)
707
+ (#set! injection.include-children)
708
+ (#set! injection.language "glimmer"))
709
+
710
+ ; css`<css>`, keyframes`<css>`
711
+ (call_expression
712
+ function: (identifier) @_name
713
+ (#any-of? @_name "css" "keyframes")
714
+ arguments: (template_string) @injection.content
715
+ (#offset! @injection.content 0 1 0 -1)
716
+ (#set! injection.include-children)
717
+ (#set! injection.language "styled"))
718
+
719
+ ; styled.div`<css>`
720
+ (call_expression
721
+ function: (member_expression
722
+ object: (identifier) @_name
723
+ (#eq? @_name "styled"))
724
+ arguments: ((template_string) @injection.content
725
+ (#offset! @injection.content 0 1 0 -1)
726
+ (#set! injection.include-children)
727
+ (#set! injection.language "styled")))
728
+
729
+ ; styled(Component)`<css>`
730
+ (call_expression
731
+ function: (call_expression
732
+ function: (identifier) @_name
733
+ (#eq? @_name "styled"))
734
+ arguments: ((template_string) @injection.content
735
+ (#offset! @injection.content 0 1 0 -1)
736
+ (#set! injection.include-children)
737
+ (#set! injection.language "styled")))
738
+
739
+ ; styled.div.attrs({ prop: "foo" })`<css>`
740
+ (call_expression
741
+ function: (call_expression
742
+ function: (member_expression
743
+ object: (member_expression
744
+ object: (identifier) @_name
745
+ (#eq? @_name "styled"))))
746
+ arguments: ((template_string) @injection.content
747
+ (#offset! @injection.content 0 1 0 -1)
748
+ (#set! injection.include-children)
749
+ (#set! injection.language "styled")))
750
+
751
+ ; styled(Component).attrs({ prop: "foo" })`<css>`
752
+ (call_expression
753
+ function: (call_expression
754
+ function: (member_expression
755
+ object: (call_expression
756
+ function: (identifier) @_name
757
+ (#eq? @_name "styled"))))
758
+ arguments: ((template_string) @injection.content
759
+ (#offset! @injection.content 0 1 0 -1)
760
+ (#set! injection.include-children)
761
+ (#set! injection.language "styled")))
762
+
763
+ ((regex_pattern) @injection.content
764
+ (#set! injection.language "regex"))
765
+
766
+ ; ((comment) @_gql_comment
767
+ ; (#eq? @_gql_comment "/* GraphQL */")
768
+ ; (template_string) @injection.content
769
+ ; (#set! injection.language "graphql"))
770
+ ((template_string) @injection.content
771
+ (#match? @injection.content "^`#graphql")
772
+ (#offset! @injection.content 0 1 0 -1)
773
+ (#set! injection.include-children)
774
+ (#set! injection.language "graphql"))
775
+
776
+ ; el.innerHTML = `<html>`
777
+ (assignment_expression
778
+ left: (member_expression
779
+ property: (property_identifier) @_prop
780
+ (#any-of? @_prop "outerHTML" "innerHTML"))
781
+ right: (template_string) @injection.content
782
+ (#offset! @injection.content 0 1 0 -1)
783
+ (#set! injection.include-children)
784
+ (#set! injection.language "html"))
785
+
786
+ ; el.innerHTML = '<html>'
787
+ (assignment_expression
788
+ left: (member_expression
789
+ property: (property_identifier) @_prop
790
+ (#any-of? @_prop "outerHTML" "innerHTML"))
791
+ right: (string
792
+ (string_fragment) @injection.content)
793
+ (#set! injection.language "html"))
794
+
795
+ ;---- Angular injections -----
796
+ ; @Component({
797
+ ; template: `<html>`
798
+ ; })
799
+ (decorator
800
+ (call_expression
801
+ function: ((identifier) @_name
802
+ (#eq? @_name "Component"))
803
+ arguments: (arguments
804
+ (object
805
+ (pair
806
+ key: ((property_identifier) @_prop
807
+ (#eq? @_prop "template"))
808
+ value: ((template_string) @injection.content
809
+ (#offset! @injection.content 0 1 0 -1)
810
+ (#set! injection.include-children)
811
+ (#set! injection.language "angular")))))))
812
+
813
+ ; @Component({
814
+ ; styles: [`<css>`]
815
+ ; })
816
+ (decorator
817
+ (call_expression
818
+ function: ((identifier) @_name
819
+ (#eq? @_name "Component"))
820
+ arguments: (arguments
821
+ (object
822
+ (pair
823
+ key: ((property_identifier) @_prop
824
+ (#eq? @_prop "styles"))
825
+ value: (array
826
+ ((template_string) @injection.content
827
+ (#offset! @injection.content 0 1 0 -1)
828
+ (#set! injection.include-children)
829
+ (#set! injection.language "css"))))))))
830
+
831
+ ; @Component({
832
+ ; styles: `<css>`
833
+ ; })
834
+ (decorator
835
+ (call_expression
836
+ function: ((identifier) @_name
837
+ (#eq? @_name "Component"))
838
+ arguments: (arguments
839
+ (object
840
+ (pair
841
+ key: ((property_identifier) @_prop
842
+ (#eq? @_prop "styles"))
843
+ value: ((template_string) @injection.content
844
+ (#set! injection.include-children)
845
+ (#offset! @injection.content 0 1 0 -1)
846
+ (#set! injection.language "css")))))))
847
+
848
+ ; inherited from jsx
849
+ ; Styled Jsx <style jsx>
850
+ (jsx_element
851
+ (jsx_opening_element
852
+ (identifier) @_name
853
+ (#eq? @_name "style")
854
+ (jsx_attribute) @_attr
855
+ (#eq? @_attr "jsx"))
856
+ (jsx_expression
857
+ ((template_string) @injection.content
858
+ (#set! injection.language "css"))
859
+ (#offset! @injection.content 0 1 0 -1)))
860
+
861
+ """
862
+ }
863
+ }