Add tree-sitter queries for Dart, Kotlin, and Swift functions and variables
This commit is contained in:
parent
490dcffe01
commit
ecb74d49bd
15
tree-sitter-queries/dart/functions.scm
Normal file
15
tree-sitter-queries/dart/functions.scm
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
|
||||
(
|
||||
[
|
||||
(method_signature
|
||||
(name) @function.name
|
||||
)
|
||||
(function_signature
|
||||
(name) @function.name
|
||||
)
|
||||
] @_start
|
||||
.
|
||||
(function_body) @function.body
|
||||
) @function
|
31
tree-sitter-queries/dart/variables.scm
Normal file
31
tree-sitter-queries/dart/variables.scm
Normal file
@ -0,0 +1,31 @@
|
||||
(class_declaration
|
||||
(constructor
|
||||
normal_formal_parameters: (normal_formal_parameter_list
|
||||
normal_formal_parameter: (normal_formal_parameter
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(function_declaration
|
||||
formal_parameter_list: (formal_parameter_list
|
||||
normal_formal_parameters: (normal_formal_parameter_list
|
||||
normal_formal_parameter: (normal_formal_parameter
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(field_formal_parameters
|
||||
field_formal_parameter: (field_formal_parameter
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
|
||||
(variable_declaration_list
|
||||
variable_declaration: (variable_declaration
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
6
tree-sitter-queries/kotlin/functions.scm
Normal file
6
tree-sitter-queries/kotlin/functions.scm
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
(function_declaration
|
||||
(simple_identifier) @function.name
|
||||
(function_body) @function.body
|
||||
) @function
|
21
tree-sitter-queries/kotlin/variables.scm
Normal file
21
tree-sitter-queries/kotlin/variables.scm
Normal file
@ -0,0 +1,21 @@
|
||||
(class_declaration
|
||||
primary_constructor: (constructor_declaration
|
||||
value_parameters: (value_parameter
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(function_declaration
|
||||
value_parameters: (value_parameter
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @variable
|
||||
)
|
||||
|
||||
(variable_declaration
|
||||
name: (identifier) @variable
|
||||
)
|
6
tree-sitter-queries/swift/functions.scm
Normal file
6
tree-sitter-queries/swift/functions.scm
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
(function_declaration
|
||||
name: (_) @function.name
|
||||
body: (_) @function.body
|
||||
) @function
|
33
tree-sitter-queries/swift/variables.scm
Normal file
33
tree-sitter-queries/swift/variables.scm
Normal file
@ -0,0 +1,33 @@
|
||||
(class_declaration
|
||||
(initializer_declaration
|
||||
parameter_clause: (parameter_clause
|
||||
parameter_list: (parameter_list
|
||||
parameter: (parameter
|
||||
local_name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(function_declaration
|
||||
parameter_clause: (parameter_clause
|
||||
parameter_list: (parameter_list
|
||||
parameter: (parameter
|
||||
local_name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(variable_declaration
|
||||
name: (identifier) @variable
|
||||
)
|
||||
|
||||
(tuple_type
|
||||
element_list: (tuple_type_element_list
|
||||
element: (tuple_type_element
|
||||
name: (identifier) @variable
|
||||
)
|
||||
)
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user