tree-sitter-analyzer 1.9.17.1__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.
- tree_sitter_analyzer/__init__.py +132 -0
- tree_sitter_analyzer/__main__.py +11 -0
- tree_sitter_analyzer/api.py +853 -0
- tree_sitter_analyzer/cli/__init__.py +39 -0
- tree_sitter_analyzer/cli/__main__.py +12 -0
- tree_sitter_analyzer/cli/argument_validator.py +89 -0
- tree_sitter_analyzer/cli/commands/__init__.py +26 -0
- tree_sitter_analyzer/cli/commands/advanced_command.py +226 -0
- tree_sitter_analyzer/cli/commands/base_command.py +181 -0
- tree_sitter_analyzer/cli/commands/default_command.py +18 -0
- tree_sitter_analyzer/cli/commands/find_and_grep_cli.py +188 -0
- tree_sitter_analyzer/cli/commands/list_files_cli.py +133 -0
- tree_sitter_analyzer/cli/commands/partial_read_command.py +139 -0
- tree_sitter_analyzer/cli/commands/query_command.py +109 -0
- tree_sitter_analyzer/cli/commands/search_content_cli.py +161 -0
- tree_sitter_analyzer/cli/commands/structure_command.py +156 -0
- tree_sitter_analyzer/cli/commands/summary_command.py +116 -0
- tree_sitter_analyzer/cli/commands/table_command.py +414 -0
- tree_sitter_analyzer/cli/info_commands.py +124 -0
- tree_sitter_analyzer/cli_main.py +472 -0
- tree_sitter_analyzer/constants.py +85 -0
- tree_sitter_analyzer/core/__init__.py +15 -0
- tree_sitter_analyzer/core/analysis_engine.py +580 -0
- tree_sitter_analyzer/core/cache_service.py +333 -0
- tree_sitter_analyzer/core/engine.py +585 -0
- tree_sitter_analyzer/core/parser.py +293 -0
- tree_sitter_analyzer/core/query.py +605 -0
- tree_sitter_analyzer/core/query_filter.py +200 -0
- tree_sitter_analyzer/core/query_service.py +340 -0
- tree_sitter_analyzer/encoding_utils.py +530 -0
- tree_sitter_analyzer/exceptions.py +747 -0
- tree_sitter_analyzer/file_handler.py +246 -0
- tree_sitter_analyzer/formatters/__init__.py +1 -0
- tree_sitter_analyzer/formatters/base_formatter.py +201 -0
- tree_sitter_analyzer/formatters/csharp_formatter.py +367 -0
- tree_sitter_analyzer/formatters/formatter_config.py +197 -0
- tree_sitter_analyzer/formatters/formatter_factory.py +84 -0
- tree_sitter_analyzer/formatters/formatter_registry.py +377 -0
- tree_sitter_analyzer/formatters/formatter_selector.py +96 -0
- tree_sitter_analyzer/formatters/go_formatter.py +368 -0
- tree_sitter_analyzer/formatters/html_formatter.py +498 -0
- tree_sitter_analyzer/formatters/java_formatter.py +423 -0
- tree_sitter_analyzer/formatters/javascript_formatter.py +611 -0
- tree_sitter_analyzer/formatters/kotlin_formatter.py +268 -0
- tree_sitter_analyzer/formatters/language_formatter_factory.py +123 -0
- tree_sitter_analyzer/formatters/legacy_formatter_adapters.py +228 -0
- tree_sitter_analyzer/formatters/markdown_formatter.py +725 -0
- tree_sitter_analyzer/formatters/php_formatter.py +301 -0
- tree_sitter_analyzer/formatters/python_formatter.py +830 -0
- tree_sitter_analyzer/formatters/ruby_formatter.py +278 -0
- tree_sitter_analyzer/formatters/rust_formatter.py +233 -0
- tree_sitter_analyzer/formatters/sql_formatter_wrapper.py +689 -0
- tree_sitter_analyzer/formatters/sql_formatters.py +536 -0
- tree_sitter_analyzer/formatters/typescript_formatter.py +543 -0
- tree_sitter_analyzer/formatters/yaml_formatter.py +462 -0
- tree_sitter_analyzer/interfaces/__init__.py +9 -0
- tree_sitter_analyzer/interfaces/cli.py +535 -0
- tree_sitter_analyzer/interfaces/cli_adapter.py +359 -0
- tree_sitter_analyzer/interfaces/mcp_adapter.py +224 -0
- tree_sitter_analyzer/interfaces/mcp_server.py +428 -0
- tree_sitter_analyzer/language_detector.py +553 -0
- tree_sitter_analyzer/language_loader.py +271 -0
- tree_sitter_analyzer/languages/__init__.py +10 -0
- tree_sitter_analyzer/languages/csharp_plugin.py +1076 -0
- tree_sitter_analyzer/languages/css_plugin.py +449 -0
- tree_sitter_analyzer/languages/go_plugin.py +836 -0
- tree_sitter_analyzer/languages/html_plugin.py +496 -0
- tree_sitter_analyzer/languages/java_plugin.py +1299 -0
- tree_sitter_analyzer/languages/javascript_plugin.py +1622 -0
- tree_sitter_analyzer/languages/kotlin_plugin.py +656 -0
- tree_sitter_analyzer/languages/markdown_plugin.py +1928 -0
- tree_sitter_analyzer/languages/php_plugin.py +862 -0
- tree_sitter_analyzer/languages/python_plugin.py +1636 -0
- tree_sitter_analyzer/languages/ruby_plugin.py +757 -0
- tree_sitter_analyzer/languages/rust_plugin.py +673 -0
- tree_sitter_analyzer/languages/sql_plugin.py +2444 -0
- tree_sitter_analyzer/languages/typescript_plugin.py +1892 -0
- tree_sitter_analyzer/languages/yaml_plugin.py +695 -0
- tree_sitter_analyzer/legacy_table_formatter.py +860 -0
- tree_sitter_analyzer/mcp/__init__.py +34 -0
- tree_sitter_analyzer/mcp/resources/__init__.py +43 -0
- tree_sitter_analyzer/mcp/resources/code_file_resource.py +208 -0
- tree_sitter_analyzer/mcp/resources/project_stats_resource.py +586 -0
- tree_sitter_analyzer/mcp/server.py +869 -0
- tree_sitter_analyzer/mcp/tools/__init__.py +28 -0
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +779 -0
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +291 -0
- tree_sitter_analyzer/mcp/tools/base_tool.py +139 -0
- tree_sitter_analyzer/mcp/tools/fd_rg_utils.py +816 -0
- tree_sitter_analyzer/mcp/tools/find_and_grep_tool.py +686 -0
- tree_sitter_analyzer/mcp/tools/list_files_tool.py +413 -0
- tree_sitter_analyzer/mcp/tools/output_format_validator.py +148 -0
- tree_sitter_analyzer/mcp/tools/query_tool.py +443 -0
- tree_sitter_analyzer/mcp/tools/read_partial_tool.py +464 -0
- tree_sitter_analyzer/mcp/tools/search_content_tool.py +836 -0
- tree_sitter_analyzer/mcp/tools/table_format_tool.py +572 -0
- tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +653 -0
- tree_sitter_analyzer/mcp/utils/__init__.py +113 -0
- tree_sitter_analyzer/mcp/utils/error_handler.py +569 -0
- tree_sitter_analyzer/mcp/utils/file_output_factory.py +217 -0
- tree_sitter_analyzer/mcp/utils/file_output_manager.py +322 -0
- tree_sitter_analyzer/mcp/utils/gitignore_detector.py +358 -0
- tree_sitter_analyzer/mcp/utils/path_resolver.py +414 -0
- tree_sitter_analyzer/mcp/utils/search_cache.py +343 -0
- tree_sitter_analyzer/models.py +840 -0
- tree_sitter_analyzer/mypy_current_errors.txt +2 -0
- tree_sitter_analyzer/output_manager.py +255 -0
- tree_sitter_analyzer/platform_compat/__init__.py +3 -0
- tree_sitter_analyzer/platform_compat/adapter.py +324 -0
- tree_sitter_analyzer/platform_compat/compare.py +224 -0
- tree_sitter_analyzer/platform_compat/detector.py +67 -0
- tree_sitter_analyzer/platform_compat/fixtures.py +228 -0
- tree_sitter_analyzer/platform_compat/profiles.py +217 -0
- tree_sitter_analyzer/platform_compat/record.py +55 -0
- tree_sitter_analyzer/platform_compat/recorder.py +155 -0
- tree_sitter_analyzer/platform_compat/report.py +92 -0
- tree_sitter_analyzer/plugins/__init__.py +280 -0
- tree_sitter_analyzer/plugins/base.py +647 -0
- tree_sitter_analyzer/plugins/manager.py +384 -0
- tree_sitter_analyzer/project_detector.py +328 -0
- tree_sitter_analyzer/queries/__init__.py +27 -0
- tree_sitter_analyzer/queries/csharp.py +216 -0
- tree_sitter_analyzer/queries/css.py +615 -0
- tree_sitter_analyzer/queries/go.py +275 -0
- tree_sitter_analyzer/queries/html.py +543 -0
- tree_sitter_analyzer/queries/java.py +402 -0
- tree_sitter_analyzer/queries/javascript.py +724 -0
- tree_sitter_analyzer/queries/kotlin.py +192 -0
- tree_sitter_analyzer/queries/markdown.py +258 -0
- tree_sitter_analyzer/queries/php.py +95 -0
- tree_sitter_analyzer/queries/python.py +859 -0
- tree_sitter_analyzer/queries/ruby.py +92 -0
- tree_sitter_analyzer/queries/rust.py +223 -0
- tree_sitter_analyzer/queries/sql.py +555 -0
- tree_sitter_analyzer/queries/typescript.py +871 -0
- tree_sitter_analyzer/queries/yaml.py +236 -0
- tree_sitter_analyzer/query_loader.py +272 -0
- tree_sitter_analyzer/security/__init__.py +22 -0
- tree_sitter_analyzer/security/boundary_manager.py +277 -0
- tree_sitter_analyzer/security/regex_checker.py +297 -0
- tree_sitter_analyzer/security/validator.py +599 -0
- tree_sitter_analyzer/table_formatter.py +782 -0
- tree_sitter_analyzer/utils/__init__.py +53 -0
- tree_sitter_analyzer/utils/logging.py +433 -0
- tree_sitter_analyzer/utils/tree_sitter_compat.py +289 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/METADATA +485 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/RECORD +149 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/WHEEL +4 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/entry_points.txt +25 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
TypeScript Tree-sitter queries for code analysis.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# Function declarations and expressions
|
|
7
|
+
FUNCTIONS = """
|
|
8
|
+
(function_declaration
|
|
9
|
+
name: (identifier) @function.name
|
|
10
|
+
parameters: (formal_parameters) @function.params
|
|
11
|
+
return_type: (type_annotation)? @function.return_type
|
|
12
|
+
body: (statement_block) @function.body) @function.declaration
|
|
13
|
+
|
|
14
|
+
(function_expression
|
|
15
|
+
name: (identifier)? @function.name
|
|
16
|
+
parameters: (formal_parameters) @function.params
|
|
17
|
+
return_type: (type_annotation)? @function.return_type
|
|
18
|
+
body: (statement_block) @function.body) @function.expression
|
|
19
|
+
|
|
20
|
+
(arrow_function
|
|
21
|
+
parameters: (_) @function.params
|
|
22
|
+
return_type: (type_annotation)? @function.return_type
|
|
23
|
+
body: (_) @function.body) @function.arrow
|
|
24
|
+
|
|
25
|
+
(method_definition
|
|
26
|
+
name: (_) @function.name
|
|
27
|
+
parameters: (formal_parameters) @function.params
|
|
28
|
+
return_type: (type_annotation)? @function.return_type
|
|
29
|
+
body: (statement_block) @function.body) @method.definition
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
# Class declarations
|
|
33
|
+
CLASSES = """
|
|
34
|
+
(class_declaration
|
|
35
|
+
name: (type_identifier) @class.name
|
|
36
|
+
type_parameters: (type_parameters)? @class.generics
|
|
37
|
+
body: (class_body) @class.body) @class.declaration
|
|
38
|
+
|
|
39
|
+
(abstract_class_declaration
|
|
40
|
+
name: (type_identifier) @class.name
|
|
41
|
+
type_parameters: (type_parameters)? @class.generics
|
|
42
|
+
body: (class_body) @class.body) @class.abstract
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
# Interface declarations
|
|
46
|
+
INTERFACES = """
|
|
47
|
+
(interface_declaration
|
|
48
|
+
name: (type_identifier) @interface.name
|
|
49
|
+
type_parameters: (type_parameters)? @interface.generics
|
|
50
|
+
body: (interface_body) @interface.body) @interface.declaration
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
# Type aliases
|
|
54
|
+
TYPE_ALIASES = """
|
|
55
|
+
(type_alias_declaration
|
|
56
|
+
name: (type_identifier) @type.name
|
|
57
|
+
type_parameters: (type_parameters)? @type.generics
|
|
58
|
+
value: (_) @type.value) @type.alias
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
# Enum declarations
|
|
62
|
+
ENUMS = """
|
|
63
|
+
(enum_declaration
|
|
64
|
+
name: (identifier) @enum.name
|
|
65
|
+
body: (enum_body) @enum.body) @enum.declaration
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
# Variable declarations with types
|
|
69
|
+
VARIABLES = """
|
|
70
|
+
(variable_declaration
|
|
71
|
+
(variable_declarator
|
|
72
|
+
name: (identifier) @variable.name
|
|
73
|
+
type: (type_annotation)? @variable.type
|
|
74
|
+
value: (_)? @variable.value)) @variable.declaration
|
|
75
|
+
|
|
76
|
+
(lexical_declaration
|
|
77
|
+
(variable_declarator
|
|
78
|
+
name: (identifier) @variable.name
|
|
79
|
+
type: (type_annotation)? @variable.type
|
|
80
|
+
value: (_)? @variable.value)) @variable.lexical
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
# Import and export statements
|
|
84
|
+
IMPORTS = """
|
|
85
|
+
(import_statement
|
|
86
|
+
source: (string) @import.source) @import.statement
|
|
87
|
+
|
|
88
|
+
(import_statement
|
|
89
|
+
(import_clause
|
|
90
|
+
(named_imports
|
|
91
|
+
(import_specifier
|
|
92
|
+
name: (identifier) @import.name
|
|
93
|
+
alias: (identifier)? @import.alias)))) @import.named
|
|
94
|
+
|
|
95
|
+
(import_statement
|
|
96
|
+
(import_clause
|
|
97
|
+
(import_default_specifier
|
|
98
|
+
(identifier) @import.default))) @import.default
|
|
99
|
+
|
|
100
|
+
(import_statement
|
|
101
|
+
(import_clause
|
|
102
|
+
(namespace_import
|
|
103
|
+
(identifier) @import.namespace))) @import.namespace
|
|
104
|
+
|
|
105
|
+
(type_import
|
|
106
|
+
(import_clause
|
|
107
|
+
(named_imports
|
|
108
|
+
(import_specifier
|
|
109
|
+
name: (identifier) @import.type.name
|
|
110
|
+
alias: (identifier)? @import.type.alias)))) @import.type
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
EXPORTS = """
|
|
114
|
+
(export_statement
|
|
115
|
+
declaration: (_) @export.declaration) @export.statement
|
|
116
|
+
|
|
117
|
+
(export_statement
|
|
118
|
+
(export_clause
|
|
119
|
+
(export_specifier
|
|
120
|
+
name: (identifier) @export.name
|
|
121
|
+
alias: (identifier)? @export.alias))) @export.named
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
# Decorators (TypeScript specific)
|
|
125
|
+
DECORATORS = """
|
|
126
|
+
(decorator
|
|
127
|
+
(identifier) @decorator.name) @decorator.simple
|
|
128
|
+
|
|
129
|
+
(decorator
|
|
130
|
+
(call_expression
|
|
131
|
+
function: (identifier) @decorator.name
|
|
132
|
+
arguments: (arguments) @decorator.args)) @decorator.call
|
|
133
|
+
|
|
134
|
+
(decorator
|
|
135
|
+
(member_expression
|
|
136
|
+
object: (identifier) @decorator.object
|
|
137
|
+
property: (property_identifier) @decorator.name)) @decorator.member
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
# Generic type parameters
|
|
141
|
+
GENERICS = """
|
|
142
|
+
(type_parameters
|
|
143
|
+
(type_parameter
|
|
144
|
+
name: (type_identifier) @generic.name
|
|
145
|
+
constraint: (type_annotation)? @generic.constraint
|
|
146
|
+
default: (type_annotation)? @generic.default)) @generic.parameter
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
# Property signatures and method signatures
|
|
150
|
+
SIGNATURES = """
|
|
151
|
+
(property_signature
|
|
152
|
+
name: (_) @property.name
|
|
153
|
+
type: (type_annotation) @property.type) @property.signature
|
|
154
|
+
|
|
155
|
+
(method_signature
|
|
156
|
+
name: (_) @method.name
|
|
157
|
+
parameters: (formal_parameters) @method.params
|
|
158
|
+
return_type: (type_annotation)? @method.return_type) @method.signature
|
|
159
|
+
|
|
160
|
+
(construct_signature
|
|
161
|
+
parameters: (formal_parameters) @constructor.params
|
|
162
|
+
return_type: (type_annotation)? @constructor.return_type) @constructor.signature
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
# Comments
|
|
166
|
+
COMMENTS = """
|
|
167
|
+
(comment) @comment
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
# All queries combined
|
|
171
|
+
ALL_QUERIES = {
|
|
172
|
+
"functions": {
|
|
173
|
+
"query": FUNCTIONS,
|
|
174
|
+
"description": "Search all functions: declarations, expressions, and methods with type annotations",
|
|
175
|
+
},
|
|
176
|
+
"classes": {
|
|
177
|
+
"query": CLASSES,
|
|
178
|
+
"description": "Search all class declarations including abstract classes",
|
|
179
|
+
},
|
|
180
|
+
"interfaces": {
|
|
181
|
+
"query": INTERFACES,
|
|
182
|
+
"description": "Search all interfaces declarations",
|
|
183
|
+
},
|
|
184
|
+
"type_aliases": {
|
|
185
|
+
"query": TYPE_ALIASES,
|
|
186
|
+
"description": "Search all type aliases declarations",
|
|
187
|
+
},
|
|
188
|
+
"enums": {"query": ENUMS, "description": "Search all enums declarations"},
|
|
189
|
+
"variables": {
|
|
190
|
+
"query": VARIABLES,
|
|
191
|
+
"description": "Search all variables declarations with type annotations",
|
|
192
|
+
},
|
|
193
|
+
"imports": {
|
|
194
|
+
"query": IMPORTS,
|
|
195
|
+
"description": "Search all import statements including type imports",
|
|
196
|
+
},
|
|
197
|
+
"exports": {"query": EXPORTS, "description": "Search all export statements"},
|
|
198
|
+
"decorators": {"query": DECORATORS, "description": "Search all decorators"},
|
|
199
|
+
"generics": {
|
|
200
|
+
"query": GENERICS,
|
|
201
|
+
"description": "Search all generics type parameters",
|
|
202
|
+
},
|
|
203
|
+
"signatures": {
|
|
204
|
+
"query": SIGNATURES,
|
|
205
|
+
"description": "Search property signatures, method signatures, and constructor signatures",
|
|
206
|
+
},
|
|
207
|
+
"comments": {"query": COMMENTS, "description": "Search all comments"},
|
|
208
|
+
}
|
|
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 singular form aliases
|
|
217
|
+
ALL_QUERIES["function"] = {
|
|
218
|
+
"query": FUNCTIONS,
|
|
219
|
+
"description": "Search all functions (alias for functions)",
|
|
220
|
+
}
|
|
221
|
+
ALL_QUERIES["class"] = {
|
|
222
|
+
"query": CLASSES,
|
|
223
|
+
"description": "Search all classes (alias for classes)",
|
|
224
|
+
}
|
|
225
|
+
ALL_QUERIES["interface"] = {
|
|
226
|
+
"query": INTERFACES,
|
|
227
|
+
"description": "Search all interfaces (alias for interfaces)",
|
|
228
|
+
}
|
|
229
|
+
ALL_QUERIES["type"] = {
|
|
230
|
+
"query": TYPE_ALIASES,
|
|
231
|
+
"description": "Search all type aliases (alias for type_aliases)",
|
|
232
|
+
}
|
|
233
|
+
ALL_QUERIES["types"] = {
|
|
234
|
+
"query": TYPE_ALIASES,
|
|
235
|
+
"description": "Search all types (alias for type_aliases)",
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
# Add more specific function queries
|
|
239
|
+
ALL_QUERIES["function_declaration"] = {
|
|
240
|
+
"query": """
|
|
241
|
+
(function_declaration
|
|
242
|
+
name: (identifier) @function.name
|
|
243
|
+
parameters: (formal_parameters) @function.params
|
|
244
|
+
return_type: (type_annotation)? @function.return_type
|
|
245
|
+
body: (statement_block) @function.body) @function.declaration
|
|
246
|
+
""",
|
|
247
|
+
"description": "Search function declarations only",
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
ALL_QUERIES["arrow_function"] = {
|
|
251
|
+
"query": """
|
|
252
|
+
(arrow_function
|
|
253
|
+
parameters: (_) @function.params
|
|
254
|
+
return_type: (type_annotation)? @function.return_type
|
|
255
|
+
body: (_) @function.body) @function.arrow
|
|
256
|
+
""",
|
|
257
|
+
"description": "Search arrow functions only",
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
ALL_QUERIES["method_definition"] = {
|
|
261
|
+
"query": """
|
|
262
|
+
(method_definition
|
|
263
|
+
name: (_) @function.name
|
|
264
|
+
parameters: (formal_parameters) @function.params
|
|
265
|
+
return_type: (type_annotation)? @function.return_type
|
|
266
|
+
body: (statement_block) @function.body) @method.definition
|
|
267
|
+
""",
|
|
268
|
+
"description": "Search method definitions only",
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
ALL_QUERIES["async_function"] = {
|
|
272
|
+
"query": """
|
|
273
|
+
(function_declaration
|
|
274
|
+
"async" @async_keyword
|
|
275
|
+
name: (identifier) @function.name
|
|
276
|
+
parameters: (formal_parameters) @function.params
|
|
277
|
+
return_type: (type_annotation)? @function.return_type
|
|
278
|
+
body: (statement_block) @function.body) @async_function
|
|
279
|
+
""",
|
|
280
|
+
"description": "Search async function declarations",
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
# Add more specific class queries
|
|
284
|
+
ALL_QUERIES["class_declaration"] = {
|
|
285
|
+
"query": """
|
|
286
|
+
(class_declaration
|
|
287
|
+
name: (type_identifier) @class.name
|
|
288
|
+
type_parameters: (type_parameters)? @class.generics
|
|
289
|
+
body: (class_body) @class.body) @class.declaration
|
|
290
|
+
""",
|
|
291
|
+
"description": "Search class declarations only",
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
ALL_QUERIES["abstract_class"] = {
|
|
295
|
+
"query": """
|
|
296
|
+
(abstract_class_declaration
|
|
297
|
+
name: (type_identifier) @class.name
|
|
298
|
+
type_parameters: (type_parameters)? @class.generics
|
|
299
|
+
body: (class_body) @class.body) @class.abstract
|
|
300
|
+
""",
|
|
301
|
+
"description": "Search abstract class declarations",
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
# Add variable-specific queries
|
|
305
|
+
ALL_QUERIES["const_declaration"] = {
|
|
306
|
+
"query": """
|
|
307
|
+
(lexical_declaration
|
|
308
|
+
"const" @const_keyword
|
|
309
|
+
(variable_declarator
|
|
310
|
+
name: (identifier) @variable.name
|
|
311
|
+
value: (_)? @variable.value)) @const_declaration
|
|
312
|
+
""",
|
|
313
|
+
"description": "Search const declarations",
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
ALL_QUERIES["let_declaration"] = {
|
|
317
|
+
"query": """
|
|
318
|
+
(lexical_declaration
|
|
319
|
+
"let" @let_keyword
|
|
320
|
+
(variable_declarator
|
|
321
|
+
name: (identifier) @variable.name
|
|
322
|
+
value: (_)? @variable.value)) @let_declaration
|
|
323
|
+
""",
|
|
324
|
+
"description": "Search let declarations",
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
# Add import-specific queries
|
|
328
|
+
ALL_QUERIES["import_statement"] = {
|
|
329
|
+
"query": """
|
|
330
|
+
(import_statement
|
|
331
|
+
source: (string) @import.source) @import.statement
|
|
332
|
+
""",
|
|
333
|
+
"description": "Search import statements with details",
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
ALL_QUERIES["type_import"] = {
|
|
337
|
+
"query": """
|
|
338
|
+
(import_statement
|
|
339
|
+
"type" @type_keyword
|
|
340
|
+
(import_clause) @import.clause
|
|
341
|
+
source: (string) @import.source) @type_import
|
|
342
|
+
""",
|
|
343
|
+
"description": "Search type import statements",
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
# Add TypeScript-specific queries
|
|
347
|
+
ALL_QUERIES["namespace"] = {
|
|
348
|
+
"query": """
|
|
349
|
+
(module
|
|
350
|
+
name: (identifier) @namespace.name
|
|
351
|
+
body: (statement_block) @namespace.body) @namespace.declaration
|
|
352
|
+
""",
|
|
353
|
+
"description": "Search namespace declarations",
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
ALL_QUERIES["generic_type"] = {
|
|
357
|
+
"query": """
|
|
358
|
+
(type_parameters
|
|
359
|
+
(type_parameter
|
|
360
|
+
name: (type_identifier) @generic.name
|
|
361
|
+
constraint: (type_annotation)? @generic.constraint)) @generic.parameter
|
|
362
|
+
""",
|
|
363
|
+
"description": "Search generic type parameters",
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
ALL_QUERIES["union_type"] = {
|
|
367
|
+
"query": """
|
|
368
|
+
(union_type) @union.type
|
|
369
|
+
""",
|
|
370
|
+
"description": "Search union types",
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
ALL_QUERIES["intersection_type"] = {
|
|
374
|
+
"query": """
|
|
375
|
+
(intersection_type) @intersection.type
|
|
376
|
+
""",
|
|
377
|
+
"description": "Search intersection types",
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
ALL_QUERIES["conditional_type"] = {
|
|
381
|
+
"query": """
|
|
382
|
+
(conditional_type
|
|
383
|
+
left: (_) @conditional.check
|
|
384
|
+
right: (_) @conditional.extends
|
|
385
|
+
consequence: (_) @conditional.true
|
|
386
|
+
alternative: (_) @conditional.false) @conditional.type
|
|
387
|
+
""",
|
|
388
|
+
"description": "Search conditional types",
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
ALL_QUERIES["mapped_type"] = {
|
|
392
|
+
"query": """
|
|
393
|
+
(mapped_type_clause
|
|
394
|
+
name: (type_identifier) @mapped.key
|
|
395
|
+
type: (_) @mapped.value) @mapped.type
|
|
396
|
+
""",
|
|
397
|
+
"description": "Search mapped types",
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
ALL_QUERIES["index_signature"] = {
|
|
401
|
+
"query": """
|
|
402
|
+
(index_signature
|
|
403
|
+
name: (identifier) @index.name
|
|
404
|
+
type: (type_annotation) @index.type) @index.signature
|
|
405
|
+
""",
|
|
406
|
+
"description": "Search index signatures",
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
ALL_QUERIES["call_signature"] = {
|
|
410
|
+
"query": """
|
|
411
|
+
(call_signature
|
|
412
|
+
parameters: (formal_parameters) @call.params
|
|
413
|
+
return_type: (type_annotation)? @call.return) @call.signature
|
|
414
|
+
""",
|
|
415
|
+
"description": "Search call signatures",
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
ALL_QUERIES["construct_signature"] = {
|
|
419
|
+
"query": """
|
|
420
|
+
(construct_signature
|
|
421
|
+
parameters: (formal_parameters) @construct.params
|
|
422
|
+
return_type: (type_annotation)? @construct.return) @construct.signature
|
|
423
|
+
""",
|
|
424
|
+
"description": "Search construct signatures",
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
ALL_QUERIES["getter_method"] = {
|
|
428
|
+
"query": """
|
|
429
|
+
(method_definition
|
|
430
|
+
"get" @getter_keyword
|
|
431
|
+
name: (_) @getter.name
|
|
432
|
+
body: (statement_block) @getter.body) @getter.method
|
|
433
|
+
""",
|
|
434
|
+
"description": "Search getter methods",
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
ALL_QUERIES["setter_method"] = {
|
|
438
|
+
"query": """
|
|
439
|
+
(method_definition
|
|
440
|
+
"set" @setter_keyword
|
|
441
|
+
name: (_) @setter.name
|
|
442
|
+
parameters: (formal_parameters) @setter.params
|
|
443
|
+
body: (statement_block) @setter.body) @setter.method
|
|
444
|
+
""",
|
|
445
|
+
"description": "Search setter methods",
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
ALL_QUERIES["static_method"] = {
|
|
449
|
+
"query": """
|
|
450
|
+
(method_definition
|
|
451
|
+
"static" @static_keyword
|
|
452
|
+
name: (_) @static.name
|
|
453
|
+
parameters: (formal_parameters) @static.params
|
|
454
|
+
body: (statement_block) @static.body) @static.method
|
|
455
|
+
""",
|
|
456
|
+
"description": "Search static methods",
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
ALL_QUERIES["private_method"] = {
|
|
460
|
+
"query": """
|
|
461
|
+
(method_definition
|
|
462
|
+
(accessibility_modifier) @private_keyword
|
|
463
|
+
name: (_) @private.name
|
|
464
|
+
parameters: (formal_parameters) @private.params
|
|
465
|
+
body: (statement_block) @private.body) @private.method
|
|
466
|
+
(#eq? @private_keyword "private")
|
|
467
|
+
""",
|
|
468
|
+
"description": "Search private methods",
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
ALL_QUERIES["protected_method"] = {
|
|
472
|
+
"query": """
|
|
473
|
+
(method_definition
|
|
474
|
+
(accessibility_modifier) @protected_keyword
|
|
475
|
+
name: (_) @protected.name
|
|
476
|
+
parameters: (formal_parameters) @protected.params
|
|
477
|
+
body: (statement_block) @protected.body) @protected.method
|
|
478
|
+
(#eq? @protected_keyword "protected")
|
|
479
|
+
""",
|
|
480
|
+
"description": "Search protected methods",
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
ALL_QUERIES["public_method"] = {
|
|
484
|
+
"query": """
|
|
485
|
+
(method_definition
|
|
486
|
+
(accessibility_modifier) @public_keyword
|
|
487
|
+
name: (_) @public.name
|
|
488
|
+
parameters: (formal_parameters) @public.params
|
|
489
|
+
body: (statement_block) @public.body) @public.method
|
|
490
|
+
(#eq? @public_keyword "public")
|
|
491
|
+
""",
|
|
492
|
+
"description": "Search public methods",
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
ALL_QUERIES["readonly_property"] = {
|
|
496
|
+
"query": """
|
|
497
|
+
(property_signature
|
|
498
|
+
"readonly" @readonly_keyword
|
|
499
|
+
name: (_) @readonly.name
|
|
500
|
+
type: (type_annotation)? @readonly.type) @readonly.property
|
|
501
|
+
""",
|
|
502
|
+
"description": "Search readonly property declarations",
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
ALL_QUERIES["optional_property"] = {
|
|
506
|
+
"query": """
|
|
507
|
+
(property_signature
|
|
508
|
+
name: (_) @optional.name
|
|
509
|
+
"?" @optional_marker
|
|
510
|
+
type: (type_annotation)? @optional.type) @optional.property
|
|
511
|
+
""",
|
|
512
|
+
"description": "Search optional property declarations",
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
ALL_QUERIES["template_literal_type"] = {
|
|
516
|
+
"query": """
|
|
517
|
+
(template_literal_type) @template.literal
|
|
518
|
+
""",
|
|
519
|
+
"description": "Search template literal types",
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
ALL_QUERIES["keyof_type"] = {
|
|
523
|
+
"query": """
|
|
524
|
+
(keyof_type_operator
|
|
525
|
+
argument: (_) @keyof.argument) @keyof.type
|
|
526
|
+
""",
|
|
527
|
+
"description": "Search keyof type operators",
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
ALL_QUERIES["typeof_type"] = {
|
|
531
|
+
"query": """
|
|
532
|
+
(typeof_type
|
|
533
|
+
argument: (_) @typeof.argument) @typeof.type
|
|
534
|
+
""",
|
|
535
|
+
"description": "Search typeof type operators",
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
ALL_QUERIES["infer_type"] = {
|
|
539
|
+
"query": """
|
|
540
|
+
(infer_type
|
|
541
|
+
name: (type_identifier) @infer.name) @infer.type
|
|
542
|
+
""",
|
|
543
|
+
"description": "Search infer types in conditional types",
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
ALL_QUERIES["tuple_type"] = {
|
|
547
|
+
"query": """
|
|
548
|
+
(tuple_type) @tuple.type
|
|
549
|
+
""",
|
|
550
|
+
"description": "Search tuple types",
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
ALL_QUERIES["array_type"] = {
|
|
554
|
+
"query": """
|
|
555
|
+
(array_type) @array.type
|
|
556
|
+
""",
|
|
557
|
+
"description": "Search array types",
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
ALL_QUERIES["function_type"] = {
|
|
561
|
+
"query": """
|
|
562
|
+
(function_type
|
|
563
|
+
parameters: (formal_parameters) @function_type.params
|
|
564
|
+
return_type: (_) @function_type.return) @function_type.signature
|
|
565
|
+
""",
|
|
566
|
+
"description": "Search function type signatures",
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
ALL_QUERIES["constructor_type"] = {
|
|
570
|
+
"query": """
|
|
571
|
+
(constructor_type
|
|
572
|
+
parameters: (formal_parameters) @constructor_type.params
|
|
573
|
+
type: (_) @constructor_type.return) @constructor_type.signature
|
|
574
|
+
""",
|
|
575
|
+
"description": "Search constructor type signatures",
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
ALL_QUERIES["object_type"] = {
|
|
579
|
+
"query": """
|
|
580
|
+
(object_type) @object.type
|
|
581
|
+
""",
|
|
582
|
+
"description": "Search object type literals",
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
ALL_QUERIES["literal_type"] = {
|
|
586
|
+
"query": """
|
|
587
|
+
(literal_type) @literal.type
|
|
588
|
+
""",
|
|
589
|
+
"description": "Search literal types",
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
ALL_QUERIES["predicate_type"] = {
|
|
593
|
+
"query": """
|
|
594
|
+
(type_predicate
|
|
595
|
+
parameter_name: (identifier) @predicate.param
|
|
596
|
+
type: (_) @predicate.type) @predicate.signature
|
|
597
|
+
""",
|
|
598
|
+
"description": "Search predicate type signatures",
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
ALL_QUERIES["asserts_type"] = {
|
|
602
|
+
"query": """
|
|
603
|
+
(asserts
|
|
604
|
+
parameter_name: (identifier) @asserts.param
|
|
605
|
+
type: (_)? @asserts.type) @asserts.signature
|
|
606
|
+
""",
|
|
607
|
+
"description": "Search asserts type signatures",
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
ALL_QUERIES["override_method"] = {
|
|
611
|
+
"query": """
|
|
612
|
+
(method_definition
|
|
613
|
+
"override" @override_keyword
|
|
614
|
+
name: (_) @override.name
|
|
615
|
+
parameters: (formal_parameters) @override.params
|
|
616
|
+
body: (statement_block) @override.body) @override.method
|
|
617
|
+
""",
|
|
618
|
+
"description": "Search override methods",
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
ALL_QUERIES["abstract_method"] = {
|
|
622
|
+
"query": """
|
|
623
|
+
(method_definition
|
|
624
|
+
"abstract" @abstract_keyword
|
|
625
|
+
name: (_) @abstract.name
|
|
626
|
+
parameters: (formal_parameters) @abstract.params) @abstract.method
|
|
627
|
+
""",
|
|
628
|
+
"description": "Search abstract methods",
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
# Add more TypeScript-specific queries
|
|
632
|
+
ALL_QUERIES["jsx_element"] = {
|
|
633
|
+
"query": """
|
|
634
|
+
(jsx_element
|
|
635
|
+
open_tag: (jsx_opening_element
|
|
636
|
+
name: (_) @jsx.tag_name) @jsx.open_tag
|
|
637
|
+
close_tag: (jsx_closing_element)? @jsx.close_tag) @jsx.element
|
|
638
|
+
""",
|
|
639
|
+
"description": "Search JSX elements",
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
ALL_QUERIES["jsx_self_closing"] = {
|
|
643
|
+
"query": """
|
|
644
|
+
(jsx_self_closing_element
|
|
645
|
+
name: (_) @jsx.tag_name) @jsx.self_closing
|
|
646
|
+
""",
|
|
647
|
+
"description": "Search jsx self closing elements",
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
ALL_QUERIES["jsx_fragment"] = {
|
|
651
|
+
"query": """
|
|
652
|
+
(jsx_fragment) @jsx.fragment
|
|
653
|
+
""",
|
|
654
|
+
"description": "Search JSX fragments",
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
ALL_QUERIES["jsx_expression"] = {
|
|
658
|
+
"query": """
|
|
659
|
+
(jsx_expression) @jsx.expression
|
|
660
|
+
""",
|
|
661
|
+
"description": "Search JSX expressions",
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
ALL_QUERIES["as_expression"] = {
|
|
665
|
+
"query": """
|
|
666
|
+
(as_expression) @as.assertion
|
|
667
|
+
""",
|
|
668
|
+
"description": "Search as expression type assertions",
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
ALL_QUERIES["type_assertion"] = {
|
|
672
|
+
"query": """
|
|
673
|
+
(type_assertion
|
|
674
|
+
type: (_) @assertion.type
|
|
675
|
+
expression: (_) @assertion.expression) @type.assertion
|
|
676
|
+
""",
|
|
677
|
+
"description": "Search angle bracket type assertions",
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
ALL_QUERIES["satisfies_expression"] = {
|
|
681
|
+
"query": """
|
|
682
|
+
(satisfies_expression
|
|
683
|
+
expression: (_) @satisfies.expression
|
|
684
|
+
type: (_) @satisfies.type) @satisfies.assertion
|
|
685
|
+
""",
|
|
686
|
+
"description": "Search satisfies expression type checks",
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
ALL_QUERIES["non_null_expression"] = {
|
|
690
|
+
"query": """
|
|
691
|
+
(non_null_expression
|
|
692
|
+
expression: (_) @non_null.expression) @non_null.assertion
|
|
693
|
+
""",
|
|
694
|
+
"description": "Search non null expression assertions (!)",
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
ALL_QUERIES["optional_chain"] = {
|
|
698
|
+
"query": """
|
|
699
|
+
(optional_chain) @optional.chain
|
|
700
|
+
""",
|
|
701
|
+
"description": "Search optional chaining expressions",
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
ALL_QUERIES["nullish_coalescing"] = {
|
|
705
|
+
"query": """
|
|
706
|
+
(binary_expression
|
|
707
|
+
left: (_) @nullish.left
|
|
708
|
+
"??" @nullish.operator
|
|
709
|
+
right: (_) @nullish.right) @nullish.coalescing
|
|
710
|
+
""",
|
|
711
|
+
"description": "Search nullish coalescing expressions (??)",
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
ALL_QUERIES["rest_pattern"] = {
|
|
715
|
+
"query": """
|
|
716
|
+
(rest_pattern) @rest.pattern
|
|
717
|
+
""",
|
|
718
|
+
"description": "Search rest patterns (...args)",
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
ALL_QUERIES["spread_element"] = {
|
|
722
|
+
"query": """
|
|
723
|
+
(spread_element) @spread.element
|
|
724
|
+
""",
|
|
725
|
+
"description": "Search spread elements",
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
ALL_QUERIES["destructuring_pattern"] = {
|
|
729
|
+
"query": """
|
|
730
|
+
(object_pattern) @destructuring.object
|
|
731
|
+
(array_pattern) @destructuring.array
|
|
732
|
+
""",
|
|
733
|
+
"description": "Search destructuring patterns",
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
ALL_QUERIES["template_string"] = {
|
|
737
|
+
"query": """
|
|
738
|
+
(template_string) @template.string
|
|
739
|
+
""",
|
|
740
|
+
"description": "Search template strings",
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
ALL_QUERIES["regex_literal"] = {
|
|
744
|
+
"query": """
|
|
745
|
+
(regex) @regex.literal
|
|
746
|
+
""",
|
|
747
|
+
"description": "Search regex literal patterns",
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
ALL_QUERIES["this_type"] = {
|
|
751
|
+
"query": """
|
|
752
|
+
(this_type) @this.type
|
|
753
|
+
""",
|
|
754
|
+
"description": "Search this type references",
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
ALL_QUERIES["import_type"] = {
|
|
758
|
+
"query": """
|
|
759
|
+
(import_statement
|
|
760
|
+
"type" @import_type.keyword
|
|
761
|
+
(import_clause) @import_type.clause
|
|
762
|
+
source: (string) @import_type.source) @import_type.statement
|
|
763
|
+
""",
|
|
764
|
+
"description": "Search import type statements",
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
ALL_QUERIES["export_type"] = {
|
|
768
|
+
"query": """
|
|
769
|
+
(export_statement
|
|
770
|
+
"type" @export_type.keyword) @export_type.statement
|
|
771
|
+
""",
|
|
772
|
+
"description": "Search export type statements",
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
ALL_QUERIES["declare_statement"] = {
|
|
776
|
+
"query": """
|
|
777
|
+
(ambient_declaration
|
|
778
|
+
"declare" @declare.keyword) @declare.statement
|
|
779
|
+
""",
|
|
780
|
+
"description": "Search declare statements",
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
ALL_QUERIES["module_declaration"] = {
|
|
784
|
+
"query": """
|
|
785
|
+
(module
|
|
786
|
+
"module" @module.keyword
|
|
787
|
+
name: (_) @module.name
|
|
788
|
+
body: (_) @module.body) @module.declaration
|
|
789
|
+
""",
|
|
790
|
+
"description": "Search module declarations",
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
ALL_QUERIES["global_declaration"] = {
|
|
794
|
+
"query": """
|
|
795
|
+
(module
|
|
796
|
+
"global" @global.keyword
|
|
797
|
+
body: (_) @global.body) @global.declaration
|
|
798
|
+
""",
|
|
799
|
+
"description": "Search global declarations",
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
ALL_QUERIES["augmentation"] = {
|
|
803
|
+
"query": """
|
|
804
|
+
(module
|
|
805
|
+
name: (string) @augmentation.name
|
|
806
|
+
body: (_) @augmentation.body) @module.augmentation
|
|
807
|
+
""",
|
|
808
|
+
"description": "Search module augmentations",
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
ALL_QUERIES["triple_slash_directive"] = {
|
|
812
|
+
"query": """
|
|
813
|
+
(comment) @directive.comment
|
|
814
|
+
(#match? @directive.comment "^///\\s*<")
|
|
815
|
+
""",
|
|
816
|
+
"description": "Search triple slash directive comments",
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
ALL_QUERIES["readonly_modifier"] = {
|
|
820
|
+
"query": """
|
|
821
|
+
"readonly" @readonly.modifier
|
|
822
|
+
""",
|
|
823
|
+
"description": "Search readonly modifiers",
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
ALL_QUERIES["static_modifier"] = {
|
|
827
|
+
"query": """
|
|
828
|
+
"static" @static.modifier
|
|
829
|
+
""",
|
|
830
|
+
"description": "Search static modifiers",
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
ALL_QUERIES["async_modifier"] = {
|
|
834
|
+
"query": """
|
|
835
|
+
"async" @async.modifier
|
|
836
|
+
""",
|
|
837
|
+
"description": "Search async modifiers",
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
ALL_QUERIES["override_modifier"] = {
|
|
841
|
+
"query": """
|
|
842
|
+
"override" @override.modifier
|
|
843
|
+
""",
|
|
844
|
+
"description": "Search override modifiers",
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
ALL_QUERIES["abstract_modifier"] = {
|
|
848
|
+
"query": """
|
|
849
|
+
"abstract" @abstract.modifier
|
|
850
|
+
""",
|
|
851
|
+
"description": "Search abstract modifiers",
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
def get_query(name: str) -> str:
|
|
856
|
+
"""Get a specific query by name."""
|
|
857
|
+
if name in ALL_QUERIES:
|
|
858
|
+
return ALL_QUERIES[name]["query"]
|
|
859
|
+
raise ValueError(
|
|
860
|
+
f"Query '{name}' not found. Available queries: {list(ALL_QUERIES.keys())}"
|
|
861
|
+
)
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
def get_all_queries() -> dict:
|
|
865
|
+
"""Get all available queries."""
|
|
866
|
+
return ALL_QUERIES
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
def list_queries() -> list:
|
|
870
|
+
"""List all available query names."""
|
|
871
|
+
return list(ALL_QUERIES.keys())
|