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