mirror of
https://github.com/helix-editor/helix.git
synced 2025-04-04 19:37:54 +03:00
queries: Rewrite all locals
This commit is contained in:
parent
8ead488fd5
commit
ac88096c98
50 changed files with 159 additions and 535 deletions
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
; (i)
|
; (i)
|
||||||
(formal_parameters
|
(formal_parameters
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; (i = 1)
|
; (i = 1)
|
||||||
(formal_parameters
|
(formal_parameters
|
||||||
(assignment_pattern
|
(assignment_pattern
|
||||||
left: (identifier) @local.definition))
|
left: (identifier) @local.definition.variable.parameter))
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
(type_parameter
|
(type_parameter
|
||||||
name: (type_identifier) @local.definition)
|
name: (type_identifier) @local.definition.type.parameter)
|
||||||
|
|
||||||
; Javascript and Typescript Treesitter grammars deviate when defining the
|
; Javascript and Typescript Treesitter grammars deviate when defining the
|
||||||
; tree structure for parameters, so we need to address them in each specific
|
; tree structure for parameters, so we need to address them in each specific
|
||||||
|
@ -20,14 +20,15 @@
|
||||||
; (i: t)
|
; (i: t)
|
||||||
; (i: t = 1)
|
; (i: t = 1)
|
||||||
(required_parameter
|
(required_parameter
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; (i?: t)
|
; (i?: t)
|
||||||
; (i?: t = 1) // Invalid but still possible to highlight.
|
; (i?: t = 1) // Invalid but still possible to highlight.
|
||||||
(optional_parameter
|
(optional_parameter
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
;-----------
|
;-----------
|
||||||
|
|
||||||
(type_identifier) @local.reference
|
(type_identifier) @local.reference
|
||||||
|
(identifier) @local.reference
|
||||||
|
|
|
@ -5,25 +5,6 @@
|
||||||
(subprogram_body) @local.scope
|
(subprogram_body) @local.scope
|
||||||
(block_statement) @local.scope
|
(block_statement) @local.scope
|
||||||
|
|
||||||
(with_clause (_) @local.definition)
|
(parameter_specification . (identifier) @local.definition.variable.parameter)
|
||||||
(procedure_specification name: (_) @local.definition)
|
|
||||||
(function_specification name: (_) @local.definition)
|
|
||||||
(package_declaration name: (_) @local.definition)
|
|
||||||
(package_body name: (_) @local.definition)
|
|
||||||
(generic_instantiation . name: (_) @local.definition)
|
|
||||||
(component_declaration . (identifier) @local.definition)
|
|
||||||
(exception_declaration . (identifier) @local.definition)
|
|
||||||
(formal_object_declaration . (identifier) @local.definition)
|
|
||||||
(object_declaration . (identifier) @local.definition)
|
|
||||||
(parameter_specification . (identifier) @local.definition)
|
|
||||||
(full_type_declaration . (identifier) @local.definition)
|
|
||||||
(private_type_declaration . (identifier) @local.definition)
|
|
||||||
(private_extension_declaration . (identifier) @local.definition)
|
|
||||||
(incomplete_type_declaration . (identifier) @local.definition)
|
|
||||||
(protected_type_declaration . (identifier) @local.definition)
|
|
||||||
(formal_complete_type_declaration . (identifier) @local.definition)
|
|
||||||
(formal_incomplete_type_declaration . (identifier) @local.definition)
|
|
||||||
(task_type_declaration . (identifier) @local.definition)
|
|
||||||
(subtype_declaration . (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(type_parameters
|
(type_parameters
|
||||||
(type_identifier) @local.definition)
|
(type_identifier) @local.definition.type.parameter)
|
||||||
(constrained_type_parameter
|
(constrained_type_parameter
|
||||||
left: (type_identifier) @local.definition)
|
left: (type_identifier) @local.definition.type.parameter)
|
||||||
|
|
||||||
(closure_parameters (identifier) @local.definition)
|
(closure_parameters (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -30,67 +30,7 @@
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(annotation_definition_identifier) @local.definition
|
|
||||||
|
|
||||||
(const_identifier) @local.definition
|
|
||||||
|
|
||||||
(enum (enum_identifier) @local.definition)
|
|
||||||
|
|
||||||
[
|
|
||||||
(enum_member)
|
|
||||||
(field_identifier)
|
|
||||||
] @local.definition
|
|
||||||
|
|
||||||
(method_identifier) @local.definition
|
|
||||||
|
|
||||||
(namespace) @local.definition
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(param_identifier)
|
(param_identifier)
|
||||||
(return_identifier)
|
(return_identifier)
|
||||||
] @local.definition
|
] @local.definition.variable.parameter
|
||||||
|
|
||||||
(group (type_identifier) @local.definition)
|
|
||||||
|
|
||||||
(struct (type_identifier) @local.definition)
|
|
||||||
|
|
||||||
(union (type_identifier) @local.definition)
|
|
||||||
|
|
||||||
(interface (type_identifier) @local.definition)
|
|
||||||
|
|
||||||
; Generics Related (don't know how to combine these)
|
|
||||||
|
|
||||||
(struct
|
|
||||||
(generics
|
|
||||||
(generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
||||||
(interface
|
|
||||||
(generics
|
|
||||||
(generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
||||||
(method
|
|
||||||
(implicit_generics
|
|
||||||
(implicit_generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
||||||
(method
|
|
||||||
(generics
|
|
||||||
(generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
||||||
(annotation
|
|
||||||
(generics
|
|
||||||
(generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
||||||
(replace_using
|
|
||||||
(generics
|
|
||||||
(generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
||||||
(return_type
|
|
||||||
(generics
|
|
||||||
(generic_parameters
|
|
||||||
(generic_identifier) @local.definition)))
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
(main_component_definition) @local.scope
|
(main_component_definition) @local.scope
|
||||||
(block_statement) @local.scope
|
(block_statement) @local.scope
|
||||||
|
|
||||||
(parameter name: (identifier) @local.definition) @local.definition
|
(parameter name: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
|
@ -12,7 +12,7 @@
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
body: (_) @local.definition)
|
body: (_) @local.definition.type)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
;------------
|
;------------
|
||||||
|
|
|
@ -12,30 +12,9 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
; ...i
|
|
||||||
(rest_pattern
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
; { i }
|
|
||||||
(object_pattern
|
|
||||||
(shorthand_property_identifier_pattern) @local.definition)
|
|
||||||
|
|
||||||
; { a: i }
|
|
||||||
(object_pattern
|
|
||||||
(pair_pattern
|
|
||||||
value: (identifier) @local.definition))
|
|
||||||
|
|
||||||
; [ i ]
|
|
||||||
(array_pattern
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
; i => ...
|
; i => ...
|
||||||
(arrow_function
|
(arrow_function
|
||||||
parameter: (identifier) @local.definition)
|
parameter: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; const/let/var i = ...
|
|
||||||
(variable_declarator
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
; References
|
; References
|
||||||
;------------
|
;------------
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
(infix_declaration) @local.scope
|
(infix_declaration) @local.scope
|
||||||
(let_in_expr) @local.scope
|
(let_in_expr) @local.scope
|
||||||
|
|
||||||
(function_declaration_left (lower_pattern (lower_case_identifier)) @local.definition)
|
(function_declaration_left (lower_pattern (lower_case_identifier)) @local.definition.function)
|
||||||
(function_declaration_left (lower_case_identifier) @local.definition)
|
(function_declaration_left (lower_case_identifier) @local.definition.function)
|
||||||
|
|
||||||
(value_expr(value_qid(upper_case_identifier)) @local.reference)
|
(value_expr(value_qid(upper_case_identifier)) @local.reference)
|
||||||
(value_expr(value_qid(lower_case_identifier)) @local.reference)
|
(value_expr(value_qid(lower_case_identifier)) @local.reference)
|
||||||
|
|
|
@ -1,30 +1,23 @@
|
||||||
; Specs and Callbacks
|
; Specs and Callbacks
|
||||||
(attribute
|
(attribute
|
||||||
(stab_clause
|
(stab_clause
|
||||||
pattern: (arguments (variable)? @local.definition)
|
pattern: (arguments (variable)? @local.definition.variable.parameter)
|
||||||
; If a spec uses a variable as the return type (and later a `when` clause to type it):
|
; If a spec uses a variable as the return type (and later a `when` clause to type it):
|
||||||
body: (variable)? @local.definition)) @local.scope
|
body: (variable)? @local.definition.variable.parameter)) @local.scope
|
||||||
|
|
||||||
; parametric `-type`s
|
; parametric `-type`s
|
||||||
((attribute
|
((attribute
|
||||||
name: (atom) @_type
|
name: (atom) @_type
|
||||||
(arguments
|
(arguments
|
||||||
(binary_operator
|
(binary_operator
|
||||||
left: (call (arguments (variable) @local.definition))
|
left: (call (arguments (variable) @local.definition.variable.parameter))
|
||||||
operator: "::") @local.scope))
|
operator: "::") @local.scope))
|
||||||
(#match? @_type "(type|opaque)"))
|
(#match? @_type "(type|opaque)"))
|
||||||
|
|
||||||
; macros
|
|
||||||
((attribute
|
|
||||||
name: (atom) @_define
|
|
||||||
(arguments
|
|
||||||
(call (arguments (variable) @local.definition)))) @local.scope
|
|
||||||
(#eq? @_define "define"))
|
|
||||||
|
|
||||||
; `fun`s
|
; `fun`s
|
||||||
(anonymous_function (stab_clause pattern: (arguments (variable) @local.definition))) @local.scope
|
(anonymous_function (stab_clause pattern: (arguments (variable) @local.definition.variable.parameter))) @local.scope
|
||||||
|
|
||||||
; Ordinary functions
|
; Ordinary functions
|
||||||
(function_clause pattern: (arguments (variable) @local.definition)) @local.scope
|
(function_clause pattern: (arguments (variable) @local.definition.variable.parameter)) @local.scope
|
||||||
|
|
||||||
(variable) @local.reference
|
(variable) @local.reference
|
||||||
|
|
|
@ -6,27 +6,16 @@
|
||||||
(function_or_value_defn)
|
(function_or_value_defn)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
(value_declaration_left
|
|
||||||
.
|
|
||||||
[
|
|
||||||
(_ (identifier) @local.definition)
|
|
||||||
(_ (_ (identifier) @local.definition))
|
|
||||||
(_ (_ (_ (identifier) @local.definition)))
|
|
||||||
(_ (_ (_ (_ (identifier) @local.definition))))
|
|
||||||
(_ (_ (_ (_ (_ (identifier) @local.definition)))))
|
|
||||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition))))))
|
|
||||||
])
|
|
||||||
|
|
||||||
(function_declaration_left
|
(function_declaration_left
|
||||||
.
|
.
|
||||||
((_) @local.definition)
|
((_) @local.definition.function)
|
||||||
((argument_patterns
|
((argument_patterns
|
||||||
[
|
[
|
||||||
(_ (identifier) @local.definition)
|
(_ (identifier) @local.definition.variable.parameter)
|
||||||
(_ (_ (identifier) @local.definition))
|
(_ (_ (identifier) @local.definition.variable.parameter))
|
||||||
(_ (_ (_ (identifier) @local.definition)))
|
(_ (_ (_ (identifier) @local.definition.variable.parameter)))
|
||||||
(_ (_ (_ (_ (identifier) @local.definition))))
|
(_ (_ (_ (_ (identifier) @local.definition.variable.parameter))))
|
||||||
(_ (_ (_ (_ (_ (identifier) @local.definition)))))
|
(_ (_ (_ (_ (_ (identifier) @local.definition.variable.parameter)))))
|
||||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition))))))
|
(_ (_ (_ (_ (_ (_ (identifier) @local.definition.variable.parameter))))))
|
||||||
])
|
])
|
||||||
))
|
))
|
||||||
|
|
|
@ -4,12 +4,7 @@
|
||||||
(case_clause) @local.scope
|
(case_clause) @local.scope
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
(let pattern: (identifier) @local.definition)
|
(function_parameter name: (identifier) @local.definition.variable.parameter)
|
||||||
(function_parameter name: (identifier) @local.definition)
|
|
||||||
(list_pattern (identifier) @local.definition)
|
|
||||||
(list_pattern assign: (identifier) @local.definition)
|
|
||||||
(tuple_pattern (identifier) @local.definition)
|
|
||||||
(record_pattern_argument pattern: (identifier) @local.definition)
|
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
; Copyright (C) 2021 Will Cassella (github@willcassella.com)
|
|
||||||
;
|
|
||||||
; Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
; you may not use this file except in compliance with the License.
|
|
||||||
; You may obtain a copy of the License at
|
|
||||||
;
|
|
||||||
; http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
;
|
|
||||||
; Unless required by applicable law or agreed to in writing, software
|
|
||||||
; distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
; See the License for the specific language governing permissions and
|
|
||||||
; limitations under the License.
|
|
||||||
|
|
||||||
(source_file) @local.scope
|
|
||||||
(assignment target: (identifier) @local.definition)
|
|
|
@ -10,26 +10,14 @@
|
||||||
|
|
||||||
(type_parameter_list
|
(type_parameter_list
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
name: (identifier) @local.definition))
|
name: (identifier) @local.definition.variable.parameter))
|
||||||
|
|
||||||
(parameter_declaration (identifier) @local.definition)
|
(parameter_declaration (identifier) @local.definition.variable.parameter)
|
||||||
(variadic_parameter_declaration (identifier) @local.definition)
|
(variadic_parameter_declaration (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(short_var_declaration
|
|
||||||
left: (expression_list
|
|
||||||
(identifier) @local.definition))
|
|
||||||
|
|
||||||
(var_spec
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(for_statement
|
|
||||||
(range_clause
|
|
||||||
left: (expression_list
|
|
||||||
(identifier) @local.definition)))
|
|
||||||
|
|
||||||
(const_declaration
|
(const_declaration
|
||||||
(const_spec
|
(const_spec
|
||||||
name: (identifier) @local.definition))
|
name: (identifier) @local.definition.constant))
|
||||||
|
|
||||||
; References
|
; References
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
(infix_declaration) @local.scope
|
(infix_declaration) @local.scope
|
||||||
(let_in_expr) @local.scope
|
(let_in_expr) @local.scope
|
||||||
|
|
||||||
(function_declaration_left (lower_pattern (lower_case_identifier)) @local.definition)
|
(function_declaration_left (lower_pattern (lower_case_identifier)) @local.definition.function)
|
||||||
(function_declaration_left (lower_case_identifier) @local.definition)
|
(function_declaration_left (lower_case_identifier) @local.definition.function)
|
||||||
|
|
||||||
(value_expr(value_qid(upper_case_identifier)) @local.reference)
|
(value_expr(value_qid(upper_case_identifier)) @local.reference)
|
||||||
(value_expr(value_qid(lower_case_identifier)) @local.reference)
|
(value_expr(value_qid(lower_case_identifier)) @local.reference)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function_definition) @local.scope
|
(function_definition) @local.scope
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -3,17 +3,10 @@
|
||||||
(function_declaration) @local.scope
|
(function_declaration) @local.scope
|
||||||
(compound_expression) @local.scope
|
(compound_expression) @local.scope
|
||||||
|
|
||||||
(global_binding
|
|
||||||
(identifier) @local.definition)
|
|
||||||
(constant_binding
|
|
||||||
(identifier) @local.definition)
|
|
||||||
(type_binding
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.function)
|
||||||
(function_declaration
|
(function_declaration
|
||||||
(parameter (name) @local.definition))
|
(parameter (name) @local.definition.variable.parameter))
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
(fields (variable)) @local.definition
|
|
|
@ -1,4 +1,3 @@
|
||||||
(signature name: (variable)) @local.definition
|
(signature name: (variable) @local.definition.function)
|
||||||
(function name: (variable)) @local.definition
|
(function name: (variable) @local.definition.function)
|
||||||
(pat_name (variable)) @local.definition
|
|
||||||
(exp_name (variable)) @local.reference
|
(exp_name (variable)) @local.reference
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
(block)
|
(block)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
(argument name: _ @local.definition)
|
(argument name: _ @local.definition.variable.parameter)
|
||||||
(define_variable name: _ @local.definition)
|
(named_argument name: _ @local.definition.variable.parameter)
|
||||||
(named_argument name: _ @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
;; From nvim-treesitter, contributed by @ObserverOfTime et al.
|
;; From nvim-treesitter, contributed by @ObserverOfTime et al.
|
||||||
|
|
||||||
(funcdef
|
(funcdef
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.function)
|
||||||
|
|
||||||
(funcdefargs
|
(funcdefargs
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(funcname) @local.reference
|
(funcname) @local.reference
|
||||||
|
|
||||||
|
|
|
@ -2,81 +2,30 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
; -----------
|
; -----------
|
||||||
|
|
||||||
; Variables
|
|
||||||
(assignment
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(assignment
|
|
||||||
(tuple_expression
|
|
||||||
(identifier) @local.definition))
|
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
(const_statement
|
(const_statement
|
||||||
(assignment
|
(assignment
|
||||||
. (identifier) @local.definition))
|
. (identifier) @local.definition.constant))
|
||||||
|
|
||||||
; let/const bindings
|
|
||||||
(let_binding
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(let_binding
|
|
||||||
(tuple_expression
|
|
||||||
(identifier) @local.definition))
|
|
||||||
|
|
||||||
; For bindings
|
|
||||||
(for_binding
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(for_binding
|
|
||||||
(tuple_expression
|
|
||||||
(identifier) @local.definition))
|
|
||||||
|
|
||||||
; Types
|
|
||||||
(struct_definition
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(abstract_definition
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(abstract_definition
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(type_parameter_list
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
; Module imports
|
|
||||||
(import_statement
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
; Parameters
|
; Parameters
|
||||||
(parameter_list
|
(parameter_list
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(optional_parameter
|
(optional_parameter
|
||||||
.
|
.
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(slurp_parameter
|
(slurp_parameter
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(typed_parameter
|
(typed_parameter
|
||||||
parameter: (identifier) @local.definition
|
parameter: (identifier) @local.definition.variable.parameter
|
||||||
(_))
|
(_))
|
||||||
|
|
||||||
; Single parameter arrow function
|
; Single parameter arrow function
|
||||||
(function_expression
|
(function_expression
|
||||||
.
|
.
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; Function/macro definitions
|
|
||||||
(function_definition
|
|
||||||
name: (identifier) @local.definition) @local.scope
|
|
||||||
|
|
||||||
(short_function_definition
|
|
||||||
name: (identifier) @local.definition) @local.scope
|
|
||||||
|
|
||||||
(macro_definition
|
|
||||||
name: (identifier) @local.definition) @local.scope
|
|
||||||
|
|
||||||
; ----------
|
; ----------
|
||||||
; References
|
; References
|
||||||
|
@ -97,5 +46,8 @@
|
||||||
(let_statement)
|
(let_statement)
|
||||||
(quote_statement)
|
(quote_statement)
|
||||||
(do_clause)
|
(do_clause)
|
||||||
|
(function_definition)
|
||||||
|
(short_function_definition)
|
||||||
|
(macro_definition)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.variable)
|
||||||
|
|
||||||
(assignment
|
(assignment
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.variable)
|
||||||
|
|
||||||
(mod
|
(mod
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.namespace)
|
||||||
|
|
||||||
(recipe_parameter
|
(recipe_parameter
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(recipe
|
(recipe
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.function)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
|
|
||||||
|
|
|
@ -2,29 +2,24 @@
|
||||||
|
|
||||||
(block) @local.scope
|
(block) @local.scope
|
||||||
|
|
||||||
(pattern
|
(pparameter
|
||||||
(identifier
|
(pattern
|
||||||
(varid) @local.definition))
|
(identifier
|
||||||
|
(varid) @local.definition.variable.parameter)))
|
||||||
(decl
|
|
||||||
(apattern
|
|
||||||
(pattern
|
|
||||||
(identifier
|
|
||||||
(varid) @local.definition))))
|
|
||||||
|
|
||||||
(puredecl
|
(puredecl
|
||||||
(funid
|
(funid
|
||||||
(identifier
|
(identifier
|
||||||
(varid) @local.definition)))
|
(varid) @local.definition.function)))
|
||||||
|
|
||||||
(puredecl
|
(puredecl
|
||||||
(binder
|
(binder
|
||||||
(identifier
|
(identifier
|
||||||
(varid) @local.definition)))
|
(varid) @local.definition.function)))
|
||||||
|
|
||||||
(decl
|
(decl
|
||||||
(binder
|
(binder
|
||||||
(identifier
|
(identifier
|
||||||
(varid) @local.definition)))
|
(varid) @local.definition.function)))
|
||||||
|
|
||||||
(identifier (varid) @local.reference)
|
(identifier (varid) @local.reference)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(type_parameter
|
(type_parameter
|
||||||
(type_identifier) @local.definition)
|
(type_identifier) @local.definition.type.parameter)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
|
|
||||||
|
|
|
@ -5,26 +5,20 @@
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
(assign
|
(arg
|
||||||
lhs: (identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(variable
|
|
||||||
(identifier) @local.definition)
|
|
||||||
|
|
||||||
(arg
|
(arg
|
||||||
(identifier) @local.definition)
|
(variable (identifier)) @local.definition.parameter)
|
||||||
|
|
||||||
(arg
|
|
||||||
(variable (identifier)) @local.definition)
|
|
||||||
|
|
||||||
(import_item
|
(import_item
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.namespace)
|
||||||
|
|
||||||
(entry_block
|
(entry_block
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.other.member)
|
||||||
|
|
||||||
(entry_inline
|
(entry_inline
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.other.member)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -5,10 +5,7 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(argument
|
(argument
|
||||||
(value (var (local_var) @local.definition)))
|
(value (var (local_var) @local.definition.variable.parameter)))
|
||||||
|
|
||||||
(instruction
|
|
||||||
(local_var) @local.definition)
|
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(local_var) @local.reference
|
(local_var) @local.reference
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
(function_definition name: (identifier) @local.definition ?) @local.scope
|
(function_definition name: (identifier) @local.definition.function ?) @local.scope
|
||||||
(function_arguments (identifier)* @local.definition)
|
(function_arguments (identifier)* @local.definition.variable.parameter)
|
||||||
|
|
||||||
(lambda (arguments (identifier) @local.definition)) @local.scope
|
(lambda (arguments (identifier) @local.definition.variable.parameter)) @local.scope
|
||||||
|
|
||||||
(assignment left: ((function_call
|
|
||||||
name: (identifier) @local.definition)))
|
|
||||||
(assignment left: ((field_expression . [(function_call
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
(identifier) @local.definition])))
|
|
||||||
(assignment left: (_) @local.definition)
|
|
||||||
(assignment (multioutput_variable (_) @local.definition))
|
|
||||||
|
|
||||||
(iterator . (identifier) @local.definition)
|
|
||||||
(global_operator (identifier) @local.definition)
|
|
||||||
(persistent_operator (identifier) @local.definition)
|
|
||||||
(catch_clause (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
(value_pattern) @local.definition
|
(value_pattern) @local.definition.variable.parameter
|
||||||
|
|
||||||
; References
|
; References
|
||||||
;-----------
|
;-----------
|
||||||
|
|
|
@ -23,12 +23,8 @@
|
||||||
(try_block then_block: (block) @local.scope)
|
(try_block then_block: (block) @local.scope)
|
||||||
(with else_block: (block) @local.scope)
|
(with else_block: (block) @local.scope)
|
||||||
|
|
||||||
(field name: (identifier) @local.definition)
|
(param name: (identifier) @local.definition.variable.parameter)
|
||||||
(local name: (identifier) @local.definition)
|
(lambdaparam name: (identifier) @local.definition.variable.parameter)
|
||||||
(param name: (identifier) @local.definition)
|
|
||||||
(lambdaparam name: (identifier) @local.definition)
|
|
||||||
("for" element: (idseq (identifier) @local.definition))
|
|
||||||
(withelem name: (idseq (identifier) @local.definition))
|
|
||||||
|
|
||||||
; only lower case identifiers are references
|
; only lower case identifiers are references
|
||||||
(
|
(
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
(signature name: (variable)) @local.definition
|
(signature name: (variable) @local.definition.function)
|
||||||
(function name: (variable)) @local.definition
|
(function name: (variable) @local.definition.function)
|
||||||
(pat_name (variable)) @local.definition
|
|
||||||
(exp_name (variable)) @local.reference
|
(exp_name (variable)) @local.reference
|
||||||
|
|
|
@ -10,33 +10,33 @@
|
||||||
|
|
||||||
; Parameters
|
; Parameters
|
||||||
(parameters
|
(parameters
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
(parameters
|
(parameters
|
||||||
(typed_parameter
|
(typed_parameter
|
||||||
(identifier) @local.definition))
|
(identifier) @local.definition.variable.parameter))
|
||||||
(parameters
|
(parameters
|
||||||
(default_parameter
|
(default_parameter
|
||||||
name: (identifier) @local.definition))
|
name: (identifier) @local.definition.variable.parameter))
|
||||||
(parameters
|
(parameters
|
||||||
(typed_default_parameter
|
(typed_default_parameter
|
||||||
name: (identifier) @local.definition))
|
name: (identifier) @local.definition.variable.parameter))
|
||||||
(parameters
|
(parameters
|
||||||
(list_splat_pattern ; *args
|
(list_splat_pattern ; *args
|
||||||
(identifier) @local.definition))
|
(identifier) @local.definition.variable.parameter))
|
||||||
(parameters
|
(parameters
|
||||||
(dictionary_splat_pattern ; **kwargs
|
(dictionary_splat_pattern ; **kwargs
|
||||||
(identifier) @local.definition))
|
(identifier) @local.definition.variable.parameter))
|
||||||
|
|
||||||
(lambda_parameters
|
(lambda_parameters
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; Imports
|
; Imports
|
||||||
(import_statement
|
(import_statement
|
||||||
name: (dotted_name
|
name: (dotted_name
|
||||||
(identifier) @local.definition))
|
(identifier) @local.definition.namespace))
|
||||||
|
|
||||||
(aliased_import
|
(aliased_import
|
||||||
alias: (identifier) @local.definition)
|
alias: (identifier) @local.definition.namespace)
|
||||||
|
|
||||||
;; References
|
;; References
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
(function_definition) @local.scope
|
(function_definition) @local.scope
|
||||||
|
|
||||||
(formal_parameters (identifier) @local.definition)
|
(formal_parameters (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(left_assignment name: (identifier) @local.definition)
|
|
||||||
(equals_assignment name: (identifier) @local.definition)
|
|
||||||
(right_assignment name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
(switch_expression) @local.scope
|
|
||||||
|
|
||||||
; Definitions
|
|
||||||
;------------
|
|
||||||
(type_declaration) @local.definition
|
|
||||||
(let_binding) @local.definition
|
|
||||||
(module_declaration) @local.definition
|
|
|
@ -7,21 +7,14 @@
|
||||||
(do_block)
|
(do_block)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
(block_parameter (identifier) @local.definition)
|
(block_parameter (identifier) @local.definition.variable.parameter)
|
||||||
(block_parameters (identifier) @local.definition)
|
(block_parameters (identifier) @local.definition.variable.parameter)
|
||||||
(destructured_parameter (identifier) @local.definition)
|
(destructured_parameter (identifier) @local.definition.variable.parameter)
|
||||||
(hash_splat_parameter (identifier) @local.definition)
|
(hash_splat_parameter (identifier) @local.definition.variable.parameter)
|
||||||
(lambda_parameters (identifier) @local.definition)
|
(lambda_parameters (identifier) @local.definition.variable.parameter)
|
||||||
(method_parameters (identifier) @local.definition)
|
(method_parameters (identifier) @local.definition.variable.parameter)
|
||||||
(splat_parameter (identifier) @local.definition)
|
(splat_parameter (identifier) @local.definition.variable.parameter)
|
||||||
|
(keyword_parameter name: (identifier) @local.definition.variable.parameter)
|
||||||
(keyword_parameter name: (identifier) @local.definition)
|
(optional_parameter name: (identifier) @local.definition.variable.parameter)
|
||||||
(optional_parameter name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
(assignment left: (identifier) @local.definition)
|
|
||||||
(operator_assignment left: (identifier) @local.definition)
|
|
||||||
(left_assignment_list (identifier) @local.definition)
|
|
||||||
(rest_assignment (identifier) @local.definition)
|
|
||||||
(destructured_left_assignment (identifier) @local.definition)
|
|
||||||
|
|
|
@ -15,17 +15,9 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
(identifier) @local.definition)
|
pattern: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(type_parameters
|
(closure_parameters (identifier) @local.definition.variable.parameter)
|
||||||
(type_identifier) @local.definition)
|
|
||||||
(constrained_type_parameter
|
|
||||||
left: (type_identifier) @local.definition)
|
|
||||||
(optional_type_parameter
|
|
||||||
name: (type_identifier) @local.definition)
|
|
||||||
|
|
||||||
(closure_parameters (identifier) @local.definition)
|
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
(type_identifier) @local.reference
|
|
||||||
|
|
|
@ -3,27 +3,12 @@
|
||||||
|
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @local.definition) @local.scope
|
name: (identifier) @local.definition.function) @local.scope
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.function)
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(binding
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(val_definition
|
|
||||||
pattern: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(var_definition
|
|
||||||
pattern: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(val_declaration
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(var_declaration
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -16,27 +16,7 @@
|
||||||
(jmp_label)
|
(jmp_label)
|
||||||
] @local.reference
|
] @local.reference
|
||||||
|
|
||||||
(enum_reference
|
|
||||||
(field_identifier) @local.definition)
|
|
||||||
|
|
||||||
((field_definition
|
|
||||||
(access_modifiers) @_mod
|
|
||||||
(field_identifier) @local.definition)
|
|
||||||
(#eq? @_mod "enum"))
|
|
||||||
|
|
||||||
(field_definition
|
|
||||||
(field_identifier) @local.definition
|
|
||||||
(field_type) @local.definition)
|
|
||||||
|
|
||||||
(annotation_key) @local.definition
|
|
||||||
|
|
||||||
(method_definition
|
(method_definition
|
||||||
(method_signature (method_identifier) @local.definition))
|
(method_signature (method_identifier) @local.definition.function.method))
|
||||||
|
|
||||||
(param_identifier) @local.definition
|
(param_identifier) @local.definition.variable.parameter
|
||||||
|
|
||||||
(annotation_directive
|
|
||||||
(class_identifier) @local.definition)
|
|
||||||
|
|
||||||
(class_directive
|
|
||||||
(class_identifier) @local.definition)
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
(constructor_definition) @local.scope
|
(constructor_definition) @local.scope
|
||||||
(block_statement) @local.scope
|
(block_statement) @local.scope
|
||||||
|
|
||||||
(function_definition (parameter name: (identifier) @local.definition))
|
(function_definition (parameter name: (identifier) @local.definition.variable.parameter))
|
||||||
(constructor_definition (parameter name: (identifier) @local.definition))
|
(constructor_definition (parameter name: (identifier) @local.definition.variable.parameter))
|
||||||
(variable_declaration name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
(identifier) @local.definition)
|
(identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(closure_parameters (identifier) @local.definition)
|
(closure_parameters (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/locals.scm
|
; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/locals.scm
|
||||||
(import_declaration (identifier) @definition.import)
|
(import_declaration (identifier) @local.definition.namespace)
|
||||||
(function_declaration name: (simple_identifier) @definition.function)
|
(function_declaration name: (simple_identifier) @local.definition.function)
|
||||||
|
|
||||||
; Scopes
|
; Scopes
|
||||||
[
|
[
|
||||||
|
|
|
@ -14,14 +14,11 @@
|
||||||
; Definitions @local.definition
|
; Definitions @local.definition
|
||||||
; ------------------------------
|
; ------------------------------
|
||||||
|
|
||||||
(let_statement
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(constant
|
(constant
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition.constant)
|
||||||
|
|
||||||
; References @local.reference
|
; References @local.reference
|
||||||
; -----------------------------
|
; -----------------------------
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
|
|
||||||
(var_declaration
|
(var_declaration
|
||||||
declarators: (var_declarators
|
declarators: (var_declarators
|
||||||
(var (identifier)) @local.definition))
|
(var (identifier)) @local.definition.variable))
|
||||||
|
|
||||||
(var_assignment
|
(var_assignment
|
||||||
variables: (assignment_variables
|
variables: (assignment_variables
|
||||||
(var (identifier) @local.definition)))
|
(var (identifier) @local.definition.variable)))
|
||||||
|
|
||||||
(arg name: (identifier) @local.definition)
|
(arg name: (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
(anon_function) @local.scope
|
(anon_function) @local.scope
|
||||||
((function_statement
|
((function_statement
|
||||||
(function_name) @local.definition) @local.scope)
|
(function_name) @local.definition.function) @local.scope)
|
||||||
|
|
||||||
(program) @local.scope
|
(program) @local.scope
|
||||||
(if_statement) @local.scope
|
(if_statement) @local.scope
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (identifier) @local.definition)
|
left: (identifier) @local.definition.variable)
|
||||||
(macro_statement
|
(macro_statement
|
||||||
(parameter_list
|
(parameter_list
|
||||||
(identifier) @local.definition))
|
(identifier) @local.definition.variable.parameter))
|
||||||
(macro_statement) @local.scope
|
(macro_statement) @local.scope
|
||||||
|
|
|
@ -11,41 +11,4 @@
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(annotation_identifier) @local.definition
|
(annotation_identifier) @local.definition.attribute
|
||||||
|
|
||||||
; (const_definition (identifier) @definition.constant)
|
|
||||||
|
|
||||||
; (enum_definition "enum"
|
|
||||||
; . (identifier) @definition.enum
|
|
||||||
; "{" (identifier) @definition.constant "}")
|
|
||||||
|
|
||||||
; (senum_definition "senum"
|
|
||||||
; . (identifier) @definition.enum)
|
|
||||||
|
|
||||||
; (field (identifier) @definition.field)
|
|
||||||
|
|
||||||
; (function_definition (identifier) @definition.function)
|
|
||||||
|
|
||||||
; (namespace_declaration
|
|
||||||
; "namespace" (namespace_scope)
|
|
||||||
; . (_) @definition.namespace
|
|
||||||
; (namespace_uri)?)
|
|
||||||
|
|
||||||
; (parameter (identifier) @definition.parameter)
|
|
||||||
|
|
||||||
; (struct_definition
|
|
||||||
; "struct" . (identifier) @definition.type)
|
|
||||||
|
|
||||||
; (union_definition
|
|
||||||
; "union" . (identifier) @definition.type)
|
|
||||||
|
|
||||||
; (exception_definition
|
|
||||||
; "exception" . (identifier) @definition.type)
|
|
||||||
|
|
||||||
; (service_definition
|
|
||||||
; "service" . (identifier) @definition.type)
|
|
||||||
|
|
||||||
; (interaction_definition
|
|
||||||
; "interaction" . (identifier) @definition.type)
|
|
||||||
|
|
||||||
; (typedef_identifier) @definition.type
|
|
||||||
|
|
|
@ -15,22 +15,22 @@
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
(choose (identifier) @local.definition)
|
(choose (identifier) @local.definition.variable.parameter)
|
||||||
(choose (tuple_of_identifiers (identifier) @local.definition))
|
(choose (tuple_of_identifiers (identifier) @local.definition.variable.parameter))
|
||||||
(constant_declaration (identifier) @local.definition)
|
(constant_declaration (identifier) @local.definition.constant)
|
||||||
(constant_declaration (operator_declaration name: (_) @local.definition))
|
(constant_declaration (operator_declaration name: (_) @local.definition.constant))
|
||||||
(function_definition name: (identifier) @local.definition)
|
(function_definition name: (identifier) @local.definition.function)
|
||||||
(lambda (identifier) @local.definition)
|
(lambda (identifier) @local.definition.function)
|
||||||
(module_definition name: (_) @local.definition)
|
(module_definition name: (_) @local.definition.namespace)
|
||||||
(module_definition parameter: (identifier) @local.definition)
|
(module_definition parameter: (identifier) @local.definition.variable.parameter)
|
||||||
(module_definition parameter: (operator_declaration name: (_) @local.definition))
|
(module_definition parameter: (operator_declaration name: (_) @local.definition.variable.parameter))
|
||||||
(operator_definition name: (_) @local.definition)
|
(operator_definition name: (_) @local.definition.operator)
|
||||||
(operator_definition parameter: (identifier) @local.definition)
|
(operator_definition parameter: (identifier) @local.definition.variable.parameter)
|
||||||
(operator_definition parameter: (operator_declaration name: (_) @local.definition))
|
(operator_definition parameter: (operator_declaration name: (_) @local.definition.variable.parameter))
|
||||||
(quantifier_bound (identifier) @local.definition)
|
(quantifier_bound (identifier) @local.definition.variable.parameter)
|
||||||
(quantifier_bound (tuple_of_identifiers (identifier) @local.definition))
|
(quantifier_bound (tuple_of_identifiers (identifier) @local.definition.variable.parameter))
|
||||||
(unbounded_quantification (identifier) @local.definition)
|
(unbounded_quantification (identifier) @local.definition.variable.parameter)
|
||||||
(variable_declaration (identifier) @local.definition)
|
(variable_declaration (identifier) @local.definition.variable.builtin)
|
||||||
|
|
||||||
; Proof scopes and definitions
|
; Proof scopes and definitions
|
||||||
[
|
[
|
||||||
|
@ -39,12 +39,12 @@
|
||||||
(theorem)
|
(theorem)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
(assume_prove (new (identifier) @local.definition))
|
(assume_prove (new (identifier) @local.definition.variable.parameter))
|
||||||
(assume_prove (new (operator_declaration name: (_) @local.definition)))
|
(assume_prove (new (operator_declaration name: (_) @local.definition.variable.parameter)))
|
||||||
(assumption name: (identifier) @local.definition)
|
(assumption name: (identifier) @local.definition.constant)
|
||||||
(pick_proof_step (identifier) @local.definition)
|
(pick_proof_step (identifier) @local.definition.variable.parameter)
|
||||||
(take_proof_step (identifier) @local.definition)
|
(take_proof_step (identifier) @local.definition.variable.parameter)
|
||||||
(theorem name: (identifier) @local.definition)
|
(theorem name: (identifier) @local.definition.constant)
|
||||||
|
|
||||||
;PlusCal scopes and definitions
|
;PlusCal scopes and definitions
|
||||||
[
|
[
|
||||||
|
@ -54,10 +54,10 @@
|
||||||
(pcal_with)
|
(pcal_with)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
(pcal_macro_decl parameter: (identifier) @local.definition)
|
(pcal_macro_decl parameter: (identifier) @local.definition.variable.parameter)
|
||||||
(pcal_proc_var_decl (identifier) @local.definition)
|
(pcal_proc_var_decl (identifier) @local.definition.variable.parameter)
|
||||||
(pcal_var_decl (identifier) @local.definition)
|
(pcal_var_decl (identifier) @local.definition.variable.parameter)
|
||||||
(pcal_with (identifier) @local.definition)
|
(pcal_with (identifier) @local.definition.variable.parameter)
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier_ref) @local.reference
|
(identifier_ref) @local.reference
|
||||||
|
|
|
@ -8,54 +8,32 @@
|
||||||
(module_declaration)
|
(module_declaration)
|
||||||
] @scope
|
] @scope
|
||||||
|
|
||||||
(data_declaration
|
|
||||||
(list_of_variable_decl_assignments
|
|
||||||
(variable_decl_assignment
|
|
||||||
(simple_identifier) @definition.var)))
|
|
||||||
|
|
||||||
(genvar_initialization
|
|
||||||
(genvar_identifier
|
|
||||||
(simple_identifier) @definition.var))
|
|
||||||
|
|
||||||
(for_initialization
|
|
||||||
(for_variable_declaration
|
|
||||||
(simple_identifier) @definition.var))
|
|
||||||
|
|
||||||
(net_declaration
|
|
||||||
(list_of_net_decl_assignments
|
|
||||||
(net_decl_assignment
|
|
||||||
(simple_identifier) @definition.var)))
|
|
||||||
|
|
||||||
(ansi_port_declaration
|
|
||||||
(port_identifier
|
|
||||||
(simple_identifier) @definition.var))
|
|
||||||
|
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
(list_of_param_assignments
|
(list_of_param_assignments
|
||||||
(param_assignment
|
(param_assignment
|
||||||
(parameter_identifier
|
(parameter_identifier
|
||||||
(simple_identifier) @definition.parameter))))
|
(simple_identifier) @local.definition.variable.parameter))))
|
||||||
|
|
||||||
(local_parameter_declaration
|
(local_parameter_declaration
|
||||||
(list_of_param_assignments
|
(list_of_param_assignments
|
||||||
(param_assignment
|
(param_assignment
|
||||||
(parameter_identifier
|
(parameter_identifier
|
||||||
(simple_identifier) @definition.parameter))))
|
(simple_identifier) @local.definition.variable.parameter))))
|
||||||
|
|
||||||
;; TODO: fixme
|
;; TODO: fixme
|
||||||
;(function_declaration
|
;(function_declaration
|
||||||
;(function_identifier
|
;(function_identifier
|
||||||
;(simple_identifier) @definition.function))
|
;(simple_identifier) @local.definition.function))
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
(function_body_declaration
|
(function_body_declaration
|
||||||
(function_identifier
|
(function_identifier
|
||||||
(function_identifier
|
(function_identifier
|
||||||
(simple_identifier) @definition.function))))
|
(simple_identifier) @local.definition.function))))
|
||||||
|
|
||||||
(tf_port_item1
|
(tf_port_item1
|
||||||
(port_identifier
|
(port_identifier
|
||||||
(simple_identifier) @definition.parameter))
|
(simple_identifier) @local.definition.variable.parameter))
|
||||||
|
|
||||||
; too broad, now includes types etc
|
; too broad, now includes types etc
|
||||||
(simple_identifier) @reference
|
(simple_identifier) @local.reference
|
||||||
|
|
|
@ -6,16 +6,4 @@
|
||||||
(field) @local.reference
|
(field) @local.reference
|
||||||
(static_field) @local.reference
|
(static_field) @local.reference
|
||||||
|
|
||||||
(for_statement
|
(parameter) @local.definition.variable.parameter
|
||||||
loop_variable: (name) @local.definition)
|
|
||||||
|
|
||||||
(variable_definition
|
|
||||||
name: (name) @local.definition)
|
|
||||||
|
|
||||||
(assignment
|
|
||||||
left: (field) @local.definition)
|
|
||||||
|
|
||||||
(assignment
|
|
||||||
left: (static_field) @local.definition)
|
|
||||||
|
|
||||||
(parameter) @local.definition
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(rule_definition) @local.definition
|
(rule_definition name: (identifier) @local.definition.string.special)
|
||||||
(string_identifier) @local.definition
|
(string_identifier) @local.definition.string.special.symbol
|
||||||
|
|
||||||
(for_expression
|
(for_expression
|
||||||
(string_identifier) @local.reference)
|
(string_identifier) @local.reference)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue