tree-sitter-analyzer 1.6.0__py3-none-any.whl → 1.6.2__py3-none-any.whl
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.
Potentially problematic release.
This version of tree-sitter-analyzer might be problematic. Click here for more details.
- tree_sitter_analyzer/__init__.py +1 -1
- tree_sitter_analyzer/formatters/formatter_factory.py +3 -0
- tree_sitter_analyzer/formatters/typescript_formatter.py +432 -0
- tree_sitter_analyzer/language_detector.py +1 -1
- tree_sitter_analyzer/languages/typescript_plugin.py +1553 -0
- tree_sitter_analyzer/queries/javascript.py +1 -1
- tree_sitter_analyzer/queries/typescript.py +630 -10
- tree_sitter_analyzer-1.6.2.dist-info/METADATA +845 -0
- {tree_sitter_analyzer-1.6.0.dist-info → tree_sitter_analyzer-1.6.2.dist-info}/RECORD +11 -9
- tree_sitter_analyzer-1.6.0.dist-info/METADATA +0 -1284
- {tree_sitter_analyzer-1.6.0.dist-info → tree_sitter_analyzer-1.6.2.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-1.6.0.dist-info → tree_sitter_analyzer-1.6.2.dist-info}/entry_points.txt +0 -0
|
@@ -34,13 +34,11 @@ CLASSES = """
|
|
|
34
34
|
(class_declaration
|
|
35
35
|
name: (type_identifier) @class.name
|
|
36
36
|
type_parameters: (type_parameters)? @class.generics
|
|
37
|
-
superclass: (class_heritage)? @class.superclass
|
|
38
37
|
body: (class_body) @class.body) @class.declaration
|
|
39
38
|
|
|
40
39
|
(abstract_class_declaration
|
|
41
40
|
name: (type_identifier) @class.name
|
|
42
41
|
type_parameters: (type_parameters)? @class.generics
|
|
43
|
-
superclass: (class_heritage)? @class.superclass
|
|
44
42
|
body: (class_body) @class.body) @class.abstract
|
|
45
43
|
"""
|
|
46
44
|
|
|
@@ -49,7 +47,7 @@ INTERFACES = """
|
|
|
49
47
|
(interface_declaration
|
|
50
48
|
name: (type_identifier) @interface.name
|
|
51
49
|
type_parameters: (type_parameters)? @interface.generics
|
|
52
|
-
body: (
|
|
50
|
+
body: (interface_body) @interface.body) @interface.declaration
|
|
53
51
|
"""
|
|
54
52
|
|
|
55
53
|
# Type aliases
|
|
@@ -92,7 +90,7 @@ IMPORTS = """
|
|
|
92
90
|
(named_imports
|
|
93
91
|
(import_specifier
|
|
94
92
|
name: (identifier) @import.name
|
|
95
|
-
alias: (identifier)? @import.alias))) @import.named
|
|
93
|
+
alias: (identifier)? @import.alias)))) @import.named
|
|
96
94
|
|
|
97
95
|
(import_statement
|
|
98
96
|
(import_clause
|
|
@@ -173,7 +171,7 @@ COMMENTS = """
|
|
|
173
171
|
ALL_QUERIES = {
|
|
174
172
|
"functions": {
|
|
175
173
|
"query": FUNCTIONS,
|
|
176
|
-
"description": "Search all
|
|
174
|
+
"description": "Search all functions: declarations, expressions, and methods with type annotations",
|
|
177
175
|
},
|
|
178
176
|
"classes": {
|
|
179
177
|
"query": CLASSES,
|
|
@@ -181,16 +179,16 @@ ALL_QUERIES = {
|
|
|
181
179
|
},
|
|
182
180
|
"interfaces": {
|
|
183
181
|
"query": INTERFACES,
|
|
184
|
-
"description": "Search all
|
|
182
|
+
"description": "Search all interfaces declarations",
|
|
185
183
|
},
|
|
186
184
|
"type_aliases": {
|
|
187
185
|
"query": TYPE_ALIASES,
|
|
188
|
-
"description": "Search all type
|
|
186
|
+
"description": "Search all type aliases declarations",
|
|
189
187
|
},
|
|
190
|
-
"enums": {"query": ENUMS, "description": "Search all
|
|
188
|
+
"enums": {"query": ENUMS, "description": "Search all enums declarations"},
|
|
191
189
|
"variables": {
|
|
192
190
|
"query": VARIABLES,
|
|
193
|
-
"description": "Search all
|
|
191
|
+
"description": "Search all variables declarations with type annotations",
|
|
194
192
|
},
|
|
195
193
|
"imports": {
|
|
196
194
|
"query": IMPORTS,
|
|
@@ -200,7 +198,7 @@ ALL_QUERIES = {
|
|
|
200
198
|
"decorators": {"query": DECORATORS, "description": "Search all decorators"},
|
|
201
199
|
"generics": {
|
|
202
200
|
"query": GENERICS,
|
|
203
|
-
"description": "Search all
|
|
201
|
+
"description": "Search all generics type parameters",
|
|
204
202
|
},
|
|
205
203
|
"signatures": {
|
|
206
204
|
"query": SIGNATURES,
|
|
@@ -209,6 +207,628 @@ ALL_QUERIES = {
|
|
|
209
207
|
"comments": {"query": COMMENTS, "description": "Search all comments"},
|
|
210
208
|
}
|
|
211
209
|
|
|
210
|
+
# Add common query aliases for cross-language compatibility
|
|
211
|
+
ALL_QUERIES["methods"] = {
|
|
212
|
+
"query": FUNCTIONS,
|
|
213
|
+
"description": "Search all methods declarations (alias for functions)",
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
# Add more specific function queries
|
|
217
|
+
ALL_QUERIES["function_declaration"] = {
|
|
218
|
+
"query": """
|
|
219
|
+
(function_declaration
|
|
220
|
+
name: (identifier) @function.name
|
|
221
|
+
parameters: (formal_parameters) @function.params
|
|
222
|
+
return_type: (type_annotation)? @function.return_type
|
|
223
|
+
body: (statement_block) @function.body) @function.declaration
|
|
224
|
+
""",
|
|
225
|
+
"description": "Search function declarations only",
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
ALL_QUERIES["arrow_function"] = {
|
|
229
|
+
"query": """
|
|
230
|
+
(arrow_function
|
|
231
|
+
parameters: (_) @function.params
|
|
232
|
+
return_type: (type_annotation)? @function.return_type
|
|
233
|
+
body: (_) @function.body) @function.arrow
|
|
234
|
+
""",
|
|
235
|
+
"description": "Search arrow functions only",
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
ALL_QUERIES["method_definition"] = {
|
|
239
|
+
"query": """
|
|
240
|
+
(method_definition
|
|
241
|
+
name: (_) @function.name
|
|
242
|
+
parameters: (formal_parameters) @function.params
|
|
243
|
+
return_type: (type_annotation)? @function.return_type
|
|
244
|
+
body: (statement_block) @function.body) @method.definition
|
|
245
|
+
""",
|
|
246
|
+
"description": "Search method definitions only",
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
ALL_QUERIES["async_function"] = {
|
|
250
|
+
"query": """
|
|
251
|
+
(function_declaration
|
|
252
|
+
"async" @async_keyword
|
|
253
|
+
name: (identifier) @function.name
|
|
254
|
+
parameters: (formal_parameters) @function.params
|
|
255
|
+
return_type: (type_annotation)? @function.return_type
|
|
256
|
+
body: (statement_block) @function.body) @async_function
|
|
257
|
+
""",
|
|
258
|
+
"description": "Search async function declarations",
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
# Add more specific class queries
|
|
262
|
+
ALL_QUERIES["class_declaration"] = {
|
|
263
|
+
"query": """
|
|
264
|
+
(class_declaration
|
|
265
|
+
name: (type_identifier) @class.name
|
|
266
|
+
type_parameters: (type_parameters)? @class.generics
|
|
267
|
+
body: (class_body) @class.body) @class.declaration
|
|
268
|
+
""",
|
|
269
|
+
"description": "Search class declarations only",
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
ALL_QUERIES["abstract_class"] = {
|
|
273
|
+
"query": """
|
|
274
|
+
(abstract_class_declaration
|
|
275
|
+
name: (type_identifier) @class.name
|
|
276
|
+
type_parameters: (type_parameters)? @class.generics
|
|
277
|
+
body: (class_body) @class.body) @class.abstract
|
|
278
|
+
""",
|
|
279
|
+
"description": "Search abstract class declarations",
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
# Add variable-specific queries
|
|
283
|
+
ALL_QUERIES["const_declaration"] = {
|
|
284
|
+
"query": """
|
|
285
|
+
(lexical_declaration
|
|
286
|
+
"const" @const_keyword
|
|
287
|
+
(variable_declarator
|
|
288
|
+
name: (identifier) @variable.name
|
|
289
|
+
value: (_)? @variable.value)) @const_declaration
|
|
290
|
+
""",
|
|
291
|
+
"description": "Search const declarations",
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
ALL_QUERIES["let_declaration"] = {
|
|
295
|
+
"query": """
|
|
296
|
+
(lexical_declaration
|
|
297
|
+
"let" @let_keyword
|
|
298
|
+
(variable_declarator
|
|
299
|
+
name: (identifier) @variable.name
|
|
300
|
+
value: (_)? @variable.value)) @let_declaration
|
|
301
|
+
""",
|
|
302
|
+
"description": "Search let declarations",
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
# Add import-specific queries
|
|
306
|
+
ALL_QUERIES["import_statement"] = {
|
|
307
|
+
"query": """
|
|
308
|
+
(import_statement
|
|
309
|
+
source: (string) @import.source) @import.statement
|
|
310
|
+
""",
|
|
311
|
+
"description": "Search import statements with details",
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
ALL_QUERIES["type_import"] = {
|
|
315
|
+
"query": """
|
|
316
|
+
(import_statement
|
|
317
|
+
"type" @type_keyword
|
|
318
|
+
(import_clause) @import.clause
|
|
319
|
+
source: (string) @import.source) @type_import
|
|
320
|
+
""",
|
|
321
|
+
"description": "Search type import statements",
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
# Add TypeScript-specific queries
|
|
325
|
+
ALL_QUERIES["namespace"] = {
|
|
326
|
+
"query": """
|
|
327
|
+
(module
|
|
328
|
+
name: (identifier) @namespace.name
|
|
329
|
+
body: (statement_block) @namespace.body) @namespace.declaration
|
|
330
|
+
""",
|
|
331
|
+
"description": "Search namespace declarations",
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
ALL_QUERIES["generic_type"] = {
|
|
335
|
+
"query": """
|
|
336
|
+
(type_parameters
|
|
337
|
+
(type_parameter
|
|
338
|
+
name: (type_identifier) @generic.name
|
|
339
|
+
constraint: (type_annotation)? @generic.constraint)) @generic.parameter
|
|
340
|
+
""",
|
|
341
|
+
"description": "Search generic type parameters",
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
ALL_QUERIES["union_type"] = {
|
|
345
|
+
"query": """
|
|
346
|
+
(union_type) @union.type
|
|
347
|
+
""",
|
|
348
|
+
"description": "Search union types",
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
ALL_QUERIES["intersection_type"] = {
|
|
352
|
+
"query": """
|
|
353
|
+
(intersection_type) @intersection.type
|
|
354
|
+
""",
|
|
355
|
+
"description": "Search intersection types",
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
ALL_QUERIES["conditional_type"] = {
|
|
359
|
+
"query": """
|
|
360
|
+
(conditional_type
|
|
361
|
+
left: (_) @conditional.check
|
|
362
|
+
right: (_) @conditional.extends
|
|
363
|
+
consequence: (_) @conditional.true
|
|
364
|
+
alternative: (_) @conditional.false) @conditional.type
|
|
365
|
+
""",
|
|
366
|
+
"description": "Search conditional types",
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
ALL_QUERIES["mapped_type"] = {
|
|
370
|
+
"query": """
|
|
371
|
+
(mapped_type_clause
|
|
372
|
+
name: (type_identifier) @mapped.key
|
|
373
|
+
type: (_) @mapped.value) @mapped.type
|
|
374
|
+
""",
|
|
375
|
+
"description": "Search mapped types",
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
ALL_QUERIES["index_signature"] = {
|
|
379
|
+
"query": """
|
|
380
|
+
(index_signature
|
|
381
|
+
name: (identifier) @index.name
|
|
382
|
+
type: (type_annotation) @index.type) @index.signature
|
|
383
|
+
""",
|
|
384
|
+
"description": "Search index signatures",
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
ALL_QUERIES["call_signature"] = {
|
|
388
|
+
"query": """
|
|
389
|
+
(call_signature
|
|
390
|
+
parameters: (formal_parameters) @call.params
|
|
391
|
+
return_type: (type_annotation)? @call.return) @call.signature
|
|
392
|
+
""",
|
|
393
|
+
"description": "Search call signatures",
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
ALL_QUERIES["construct_signature"] = {
|
|
397
|
+
"query": """
|
|
398
|
+
(construct_signature
|
|
399
|
+
parameters: (formal_parameters) @construct.params
|
|
400
|
+
return_type: (type_annotation)? @construct.return) @construct.signature
|
|
401
|
+
""",
|
|
402
|
+
"description": "Search construct signatures",
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
ALL_QUERIES["getter_method"] = {
|
|
406
|
+
"query": """
|
|
407
|
+
(method_definition
|
|
408
|
+
"get" @getter_keyword
|
|
409
|
+
name: (_) @getter.name
|
|
410
|
+
body: (statement_block) @getter.body) @getter.method
|
|
411
|
+
""",
|
|
412
|
+
"description": "Search getter methods",
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
ALL_QUERIES["setter_method"] = {
|
|
416
|
+
"query": """
|
|
417
|
+
(method_definition
|
|
418
|
+
"set" @setter_keyword
|
|
419
|
+
name: (_) @setter.name
|
|
420
|
+
parameters: (formal_parameters) @setter.params
|
|
421
|
+
body: (statement_block) @setter.body) @setter.method
|
|
422
|
+
""",
|
|
423
|
+
"description": "Search setter methods",
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
ALL_QUERIES["static_method"] = {
|
|
427
|
+
"query": """
|
|
428
|
+
(method_definition
|
|
429
|
+
"static" @static_keyword
|
|
430
|
+
name: (_) @static.name
|
|
431
|
+
parameters: (formal_parameters) @static.params
|
|
432
|
+
body: (statement_block) @static.body) @static.method
|
|
433
|
+
""",
|
|
434
|
+
"description": "Search static methods",
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
ALL_QUERIES["private_method"] = {
|
|
438
|
+
"query": """
|
|
439
|
+
(method_definition
|
|
440
|
+
(accessibility_modifier) @private_keyword
|
|
441
|
+
name: (_) @private.name
|
|
442
|
+
parameters: (formal_parameters) @private.params
|
|
443
|
+
body: (statement_block) @private.body) @private.method
|
|
444
|
+
(#eq? @private_keyword "private")
|
|
445
|
+
""",
|
|
446
|
+
"description": "Search private methods",
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
ALL_QUERIES["protected_method"] = {
|
|
450
|
+
"query": """
|
|
451
|
+
(method_definition
|
|
452
|
+
(accessibility_modifier) @protected_keyword
|
|
453
|
+
name: (_) @protected.name
|
|
454
|
+
parameters: (formal_parameters) @protected.params
|
|
455
|
+
body: (statement_block) @protected.body) @protected.method
|
|
456
|
+
(#eq? @protected_keyword "protected")
|
|
457
|
+
""",
|
|
458
|
+
"description": "Search protected methods",
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
ALL_QUERIES["public_method"] = {
|
|
462
|
+
"query": """
|
|
463
|
+
(method_definition
|
|
464
|
+
(accessibility_modifier) @public_keyword
|
|
465
|
+
name: (_) @public.name
|
|
466
|
+
parameters: (formal_parameters) @public.params
|
|
467
|
+
body: (statement_block) @public.body) @public.method
|
|
468
|
+
(#eq? @public_keyword "public")
|
|
469
|
+
""",
|
|
470
|
+
"description": "Search public methods",
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
ALL_QUERIES["readonly_property"] = {
|
|
474
|
+
"query": """
|
|
475
|
+
(property_signature
|
|
476
|
+
"readonly" @readonly_keyword
|
|
477
|
+
name: (_) @readonly.name
|
|
478
|
+
type: (type_annotation)? @readonly.type) @readonly.property
|
|
479
|
+
""",
|
|
480
|
+
"description": "Search readonly property declarations",
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
ALL_QUERIES["optional_property"] = {
|
|
484
|
+
"query": """
|
|
485
|
+
(property_signature
|
|
486
|
+
name: (_) @optional.name
|
|
487
|
+
"?" @optional_marker
|
|
488
|
+
type: (type_annotation)? @optional.type) @optional.property
|
|
489
|
+
""",
|
|
490
|
+
"description": "Search optional property declarations",
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
ALL_QUERIES["template_literal_type"] = {
|
|
494
|
+
"query": """
|
|
495
|
+
(template_literal_type) @template.literal
|
|
496
|
+
""",
|
|
497
|
+
"description": "Search template literal types",
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
ALL_QUERIES["keyof_type"] = {
|
|
501
|
+
"query": """
|
|
502
|
+
(keyof_type_operator
|
|
503
|
+
argument: (_) @keyof.argument) @keyof.type
|
|
504
|
+
""",
|
|
505
|
+
"description": "Search keyof type operators",
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
ALL_QUERIES["typeof_type"] = {
|
|
509
|
+
"query": """
|
|
510
|
+
(typeof_type
|
|
511
|
+
argument: (_) @typeof.argument) @typeof.type
|
|
512
|
+
""",
|
|
513
|
+
"description": "Search typeof type operators",
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
ALL_QUERIES["infer_type"] = {
|
|
517
|
+
"query": """
|
|
518
|
+
(infer_type
|
|
519
|
+
name: (type_identifier) @infer.name) @infer.type
|
|
520
|
+
""",
|
|
521
|
+
"description": "Search infer types in conditional types",
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
ALL_QUERIES["tuple_type"] = {
|
|
525
|
+
"query": """
|
|
526
|
+
(tuple_type) @tuple.type
|
|
527
|
+
""",
|
|
528
|
+
"description": "Search tuple types",
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
ALL_QUERIES["array_type"] = {
|
|
532
|
+
"query": """
|
|
533
|
+
(array_type) @array.type
|
|
534
|
+
""",
|
|
535
|
+
"description": "Search array types",
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
ALL_QUERIES["function_type"] = {
|
|
539
|
+
"query": """
|
|
540
|
+
(function_type
|
|
541
|
+
parameters: (formal_parameters) @function_type.params
|
|
542
|
+
return_type: (_) @function_type.return) @function_type.signature
|
|
543
|
+
""",
|
|
544
|
+
"description": "Search function type signatures",
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
ALL_QUERIES["constructor_type"] = {
|
|
548
|
+
"query": """
|
|
549
|
+
(constructor_type
|
|
550
|
+
parameters: (formal_parameters) @constructor_type.params
|
|
551
|
+
type: (_) @constructor_type.return) @constructor_type.signature
|
|
552
|
+
""",
|
|
553
|
+
"description": "Search constructor type signatures",
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
ALL_QUERIES["object_type"] = {
|
|
557
|
+
"query": """
|
|
558
|
+
(object_type) @object.type
|
|
559
|
+
""",
|
|
560
|
+
"description": "Search object type literals",
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
ALL_QUERIES["literal_type"] = {
|
|
564
|
+
"query": """
|
|
565
|
+
(literal_type) @literal.type
|
|
566
|
+
""",
|
|
567
|
+
"description": "Search literal types",
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
ALL_QUERIES["predicate_type"] = {
|
|
571
|
+
"query": """
|
|
572
|
+
(type_predicate
|
|
573
|
+
parameter_name: (identifier) @predicate.param
|
|
574
|
+
type: (_) @predicate.type) @predicate.signature
|
|
575
|
+
""",
|
|
576
|
+
"description": "Search predicate type signatures",
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
ALL_QUERIES["asserts_type"] = {
|
|
580
|
+
"query": """
|
|
581
|
+
(asserts
|
|
582
|
+
parameter_name: (identifier) @asserts.param
|
|
583
|
+
type: (_)? @asserts.type) @asserts.signature
|
|
584
|
+
""",
|
|
585
|
+
"description": "Search asserts type signatures",
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
ALL_QUERIES["override_method"] = {
|
|
589
|
+
"query": """
|
|
590
|
+
(method_definition
|
|
591
|
+
"override" @override_keyword
|
|
592
|
+
name: (_) @override.name
|
|
593
|
+
parameters: (formal_parameters) @override.params
|
|
594
|
+
body: (statement_block) @override.body) @override.method
|
|
595
|
+
""",
|
|
596
|
+
"description": "Search override methods",
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
ALL_QUERIES["abstract_method"] = {
|
|
600
|
+
"query": """
|
|
601
|
+
(method_definition
|
|
602
|
+
"abstract" @abstract_keyword
|
|
603
|
+
name: (_) @abstract.name
|
|
604
|
+
parameters: (formal_parameters) @abstract.params) @abstract.method
|
|
605
|
+
""",
|
|
606
|
+
"description": "Search abstract methods",
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
# Add more TypeScript-specific queries
|
|
610
|
+
ALL_QUERIES["jsx_element"] = {
|
|
611
|
+
"query": """
|
|
612
|
+
(jsx_element
|
|
613
|
+
open_tag: (jsx_opening_element
|
|
614
|
+
name: (_) @jsx.tag_name) @jsx.open_tag
|
|
615
|
+
close_tag: (jsx_closing_element)? @jsx.close_tag) @jsx.element
|
|
616
|
+
""",
|
|
617
|
+
"description": "Search JSX elements",
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
ALL_QUERIES["jsx_self_closing"] = {
|
|
621
|
+
"query": """
|
|
622
|
+
(jsx_self_closing_element
|
|
623
|
+
name: (_) @jsx.tag_name) @jsx.self_closing
|
|
624
|
+
""",
|
|
625
|
+
"description": "Search jsx self closing elements",
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
ALL_QUERIES["jsx_fragment"] = {
|
|
629
|
+
"query": """
|
|
630
|
+
(jsx_fragment) @jsx.fragment
|
|
631
|
+
""",
|
|
632
|
+
"description": "Search JSX fragments",
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
ALL_QUERIES["jsx_expression"] = {
|
|
636
|
+
"query": """
|
|
637
|
+
(jsx_expression) @jsx.expression
|
|
638
|
+
""",
|
|
639
|
+
"description": "Search JSX expressions",
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
ALL_QUERIES["as_expression"] = {
|
|
643
|
+
"query": """
|
|
644
|
+
(as_expression) @as.assertion
|
|
645
|
+
""",
|
|
646
|
+
"description": "Search as expression type assertions",
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
ALL_QUERIES["type_assertion"] = {
|
|
650
|
+
"query": """
|
|
651
|
+
(type_assertion
|
|
652
|
+
type: (_) @assertion.type
|
|
653
|
+
expression: (_) @assertion.expression) @type.assertion
|
|
654
|
+
""",
|
|
655
|
+
"description": "Search angle bracket type assertions",
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
ALL_QUERIES["satisfies_expression"] = {
|
|
659
|
+
"query": """
|
|
660
|
+
(satisfies_expression
|
|
661
|
+
expression: (_) @satisfies.expression
|
|
662
|
+
type: (_) @satisfies.type) @satisfies.assertion
|
|
663
|
+
""",
|
|
664
|
+
"description": "Search satisfies expression type checks",
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
ALL_QUERIES["non_null_expression"] = {
|
|
668
|
+
"query": """
|
|
669
|
+
(non_null_expression
|
|
670
|
+
expression: (_) @non_null.expression) @non_null.assertion
|
|
671
|
+
""",
|
|
672
|
+
"description": "Search non null expression assertions (!)",
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
ALL_QUERIES["optional_chain"] = {
|
|
676
|
+
"query": """
|
|
677
|
+
(optional_chain) @optional.chain
|
|
678
|
+
""",
|
|
679
|
+
"description": "Search optional chaining expressions",
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
ALL_QUERIES["nullish_coalescing"] = {
|
|
683
|
+
"query": """
|
|
684
|
+
(binary_expression
|
|
685
|
+
left: (_) @nullish.left
|
|
686
|
+
"??" @nullish.operator
|
|
687
|
+
right: (_) @nullish.right) @nullish.coalescing
|
|
688
|
+
""",
|
|
689
|
+
"description": "Search nullish coalescing expressions (??)",
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
ALL_QUERIES["rest_pattern"] = {
|
|
693
|
+
"query": """
|
|
694
|
+
(rest_pattern) @rest.pattern
|
|
695
|
+
""",
|
|
696
|
+
"description": "Search rest patterns (...args)",
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
ALL_QUERIES["spread_element"] = {
|
|
700
|
+
"query": """
|
|
701
|
+
(spread_element) @spread.element
|
|
702
|
+
""",
|
|
703
|
+
"description": "Search spread elements",
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
ALL_QUERIES["destructuring_pattern"] = {
|
|
707
|
+
"query": """
|
|
708
|
+
(object_pattern) @destructuring.object
|
|
709
|
+
(array_pattern) @destructuring.array
|
|
710
|
+
""",
|
|
711
|
+
"description": "Search destructuring patterns",
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
ALL_QUERIES["template_string"] = {
|
|
715
|
+
"query": """
|
|
716
|
+
(template_string) @template.string
|
|
717
|
+
""",
|
|
718
|
+
"description": "Search template strings",
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
ALL_QUERIES["regex_literal"] = {
|
|
722
|
+
"query": """
|
|
723
|
+
(regex) @regex.literal
|
|
724
|
+
""",
|
|
725
|
+
"description": "Search regex literal patterns",
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
ALL_QUERIES["this_type"] = {
|
|
729
|
+
"query": """
|
|
730
|
+
(this_type) @this.type
|
|
731
|
+
""",
|
|
732
|
+
"description": "Search this type references",
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
ALL_QUERIES["import_type"] = {
|
|
736
|
+
"query": """
|
|
737
|
+
(import_statement
|
|
738
|
+
"type" @import_type.keyword
|
|
739
|
+
(import_clause) @import_type.clause
|
|
740
|
+
source: (string) @import_type.source) @import_type.statement
|
|
741
|
+
""",
|
|
742
|
+
"description": "Search import type statements",
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
ALL_QUERIES["export_type"] = {
|
|
746
|
+
"query": """
|
|
747
|
+
(export_statement
|
|
748
|
+
"type" @export_type.keyword) @export_type.statement
|
|
749
|
+
""",
|
|
750
|
+
"description": "Search export type statements",
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
ALL_QUERIES["declare_statement"] = {
|
|
754
|
+
"query": """
|
|
755
|
+
(ambient_declaration
|
|
756
|
+
"declare" @declare.keyword) @declare.statement
|
|
757
|
+
""",
|
|
758
|
+
"description": "Search declare statements",
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
ALL_QUERIES["module_declaration"] = {
|
|
762
|
+
"query": """
|
|
763
|
+
(module
|
|
764
|
+
"module" @module.keyword
|
|
765
|
+
name: (_) @module.name
|
|
766
|
+
body: (_) @module.body) @module.declaration
|
|
767
|
+
""",
|
|
768
|
+
"description": "Search module declarations",
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
ALL_QUERIES["global_declaration"] = {
|
|
772
|
+
"query": """
|
|
773
|
+
(module
|
|
774
|
+
"global" @global.keyword
|
|
775
|
+
body: (_) @global.body) @global.declaration
|
|
776
|
+
""",
|
|
777
|
+
"description": "Search global declarations",
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
ALL_QUERIES["augmentation"] = {
|
|
781
|
+
"query": """
|
|
782
|
+
(module
|
|
783
|
+
name: (string) @augmentation.name
|
|
784
|
+
body: (_) @augmentation.body) @module.augmentation
|
|
785
|
+
""",
|
|
786
|
+
"description": "Search module augmentations",
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
ALL_QUERIES["triple_slash_directive"] = {
|
|
790
|
+
"query": """
|
|
791
|
+
(comment) @directive.comment
|
|
792
|
+
(#match? @directive.comment "^///\\s*<")
|
|
793
|
+
""",
|
|
794
|
+
"description": "Search triple slash directive comments",
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
ALL_QUERIES["readonly_modifier"] = {
|
|
798
|
+
"query": """
|
|
799
|
+
"readonly" @readonly.modifier
|
|
800
|
+
""",
|
|
801
|
+
"description": "Search readonly modifiers",
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
ALL_QUERIES["static_modifier"] = {
|
|
805
|
+
"query": """
|
|
806
|
+
"static" @static.modifier
|
|
807
|
+
""",
|
|
808
|
+
"description": "Search static modifiers",
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
ALL_QUERIES["async_modifier"] = {
|
|
812
|
+
"query": """
|
|
813
|
+
"async" @async.modifier
|
|
814
|
+
""",
|
|
815
|
+
"description": "Search async modifiers",
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
ALL_QUERIES["override_modifier"] = {
|
|
819
|
+
"query": """
|
|
820
|
+
"override" @override.modifier
|
|
821
|
+
""",
|
|
822
|
+
"description": "Search override modifiers",
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
ALL_QUERIES["abstract_modifier"] = {
|
|
826
|
+
"query": """
|
|
827
|
+
"abstract" @abstract.modifier
|
|
828
|
+
""",
|
|
829
|
+
"description": "Search abstract modifiers",
|
|
830
|
+
}
|
|
831
|
+
|
|
212
832
|
|
|
213
833
|
def get_query(name: str) -> str:
|
|
214
834
|
"""Get a specific query by name."""
|