mirror of
https://github.com/nvim-treesitter/nvim-treesitter
synced 2024-09-16 14:34:05 +02:00
feat(locals)!: switch to upstream captures
This commit is contained in:
parent
f197a15b0d
commit
5b90ea2aba
109 changed files with 1341 additions and 1341 deletions
|
@ -253,29 +253,29 @@ highlighting (such as diagnostics or LSP semantic tokens).
|
|||
|
||||
### Locals
|
||||
|
||||
Note: pay specific attention to the captures here as they are a bit different to
|
||||
those listed in the upstream [Local Variables
|
||||
docs](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
|
||||
Some of these docs didn't exist when `nvim-treesitter` was created and the
|
||||
upstream captures are more limiting than what we have here.
|
||||
Locals are used to keep track of definitions and references in local or global
|
||||
scopes, see [upstream
|
||||
documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
|
||||
Note that nvim-treesitter uses more specific subcaptures for definitions and
|
||||
**does not use locals for highlighting**.
|
||||
|
||||
```scheme
|
||||
@definition ; various definitions
|
||||
@definition.constant ; constants
|
||||
@definition.function ; functions
|
||||
@definition.method ; methods
|
||||
@definition.var ; variables
|
||||
@definition.parameter ; parameters
|
||||
@definition.macro ; preprocessor macros
|
||||
@definition.type ; types or classes
|
||||
@definition.field ; fields or properties
|
||||
@definition.enum ; enumerations
|
||||
@definition.namespace ; modules or namespaces
|
||||
@definition.import ; imported names
|
||||
@definition.associated ; the associated type of a variable
|
||||
@local.definition ; various definitions
|
||||
@local.definition.constant ; constants
|
||||
@local.definition.function ; functions
|
||||
@local.definition.method ; methods
|
||||
@local.definition.var ; variables
|
||||
@local.definition.parameter ; parameters
|
||||
@local.definition.macro ; preprocessor macros
|
||||
@local.definition.type ; types or classes
|
||||
@local.definition.field ; fields or properties
|
||||
@local.definition.enum ; enumerations
|
||||
@local.definition.namespace ; modules or namespaces
|
||||
@local.definition.import ; imported names
|
||||
@local.definition.associated ; the associated type of a variable
|
||||
|
||||
@scope ; scope block
|
||||
@reference ; identifier reference
|
||||
@local.scope ; scope block
|
||||
@local.reference ; identifier reference
|
||||
```
|
||||
|
||||
#### Definition Scope
|
||||
|
@ -294,7 +294,7 @@ doSomething(); // Should point to the declaration as the definition
|
|||
|
||||
```query
|
||||
(function_declaration
|
||||
((identifier) @definition.var)
|
||||
((identifier) @local.definition.var)
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
```
|
||||
|
||||
|
@ -312,7 +312,7 @@ You can define folds for a given language by adding a `folds.scm` query :
|
|||
@fold ; fold this node
|
||||
```
|
||||
|
||||
If the `folds.scm` query is not present, this will fall back to the `@scope` captures in the `locals`
|
||||
If the `folds.scm` query is not present, this will fall back to the `@local.scope` captures in the `locals`
|
||||
query.
|
||||
|
||||
### Injections
|
||||
|
|
|
@ -41,8 +41,8 @@ function M.get_definitions(bufnr)
|
|||
local defs = {}
|
||||
|
||||
for _, loc in ipairs(locals) do
|
||||
if loc.definition then
|
||||
table.insert(defs, loc.definition)
|
||||
if loc["local.definition"] then
|
||||
table.insert(defs, loc["local.definition"])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -55,8 +55,8 @@ function M.get_scopes(bufnr)
|
|||
local scopes = {}
|
||||
|
||||
for _, loc in ipairs(locals) do
|
||||
if loc.scope and loc.scope.node then
|
||||
table.insert(scopes, loc.scope.node)
|
||||
if loc["local.scope"] and loc["local.scope"].node then
|
||||
table.insert(scopes, loc["local.scope"].node)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -69,8 +69,8 @@ function M.get_references(bufnr)
|
|||
local refs = {}
|
||||
|
||||
for _, loc in ipairs(locals) do
|
||||
if loc.reference and loc.reference.node then
|
||||
table.insert(refs, loc.reference.node)
|
||||
if loc["local.reference"] and loc["local.reference"].node then
|
||||
table.insert(refs, loc["local.reference"].node)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,32 +2,32 @@
|
|||
;; references. However, this is not yet supported by neovim
|
||||
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||
|
||||
(compilation) @scope
|
||||
(package_declaration) @scope
|
||||
(package_body) @scope
|
||||
(subprogram_declaration) @scope
|
||||
(subprogram_body) @scope
|
||||
(block_statement) @scope
|
||||
(compilation) @local.scope
|
||||
(package_declaration) @local.scope
|
||||
(package_body) @local.scope
|
||||
(subprogram_declaration) @local.scope
|
||||
(subprogram_body) @local.scope
|
||||
(block_statement) @local.scope
|
||||
|
||||
(with_clause (identifier) @definition.import)
|
||||
(procedure_specification name: (_) @definition.function)
|
||||
(function_specification name: (_) @definition.function)
|
||||
(package_declaration name: (_) @definition.var)
|
||||
(package_body name: (_) @definition.var)
|
||||
(generic_instantiation . name: (_) @definition.var)
|
||||
(component_declaration . (identifier) @definition.var)
|
||||
(exception_declaration . (identifier) @definition.var)
|
||||
(formal_object_declaration . (identifier) @definition.var)
|
||||
(object_declaration . (identifier) @definition.var)
|
||||
(parameter_specification . (identifier) @definition.var)
|
||||
(full_type_declaration . (identifier) @definition.type)
|
||||
(private_type_declaration . (identifier) @definition.type)
|
||||
(private_extension_declaration . (identifier) @definition.type)
|
||||
(incomplete_type_declaration . (identifier) @definition.type)
|
||||
(protected_type_declaration . (identifier) @definition.type)
|
||||
(formal_complete_type_declaration . (identifier) @definition.type)
|
||||
(formal_incomplete_type_declaration . (identifier) @definition.type)
|
||||
(task_type_declaration . (identifier) @definition.type)
|
||||
(subtype_declaration . (identifier) @definition.type)
|
||||
(with_clause (identifier) @local.definition.import)
|
||||
(procedure_specification name: (_) @local.definition.function)
|
||||
(function_specification name: (_) @local.definition.function)
|
||||
(package_declaration name: (_) @local.definition.var)
|
||||
(package_body name: (_) @local.definition.var)
|
||||
(generic_instantiation . name: (_) @local.definition.var)
|
||||
(component_declaration . (identifier) @local.definition.var)
|
||||
(exception_declaration . (identifier) @local.definition.var)
|
||||
(formal_object_declaration . (identifier) @local.definition.var)
|
||||
(object_declaration . (identifier) @local.definition.var)
|
||||
(parameter_specification . (identifier) @local.definition.var)
|
||||
(full_type_declaration . (identifier) @local.definition.type)
|
||||
(private_type_declaration . (identifier) @local.definition.type)
|
||||
(private_extension_declaration . (identifier) @local.definition.type)
|
||||
(incomplete_type_declaration . (identifier) @local.definition.type)
|
||||
(protected_type_declaration . (identifier) @local.definition.type)
|
||||
(formal_complete_type_declaration . (identifier) @local.definition.type)
|
||||
(formal_incomplete_type_declaration . (identifier) @local.definition.type)
|
||||
(task_type_declaration . (identifier) @local.definition.type)
|
||||
(subtype_declaration . (identifier) @local.definition.type)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
; declarations
|
||||
|
||||
(class_declaration) @scope
|
||||
(method_declaration) @scope
|
||||
(constructor_declaration) @scope
|
||||
(enum_declaration) @scope
|
||||
(enhanced_for_statement) @scope
|
||||
(class_declaration) @local.scope
|
||||
(method_declaration) @local.scope
|
||||
(constructor_declaration) @local.scope
|
||||
(enum_declaration) @local.scope
|
||||
(enhanced_for_statement) @local.scope
|
||||
|
||||
; if/else
|
||||
|
||||
(if_statement) @scope
|
||||
(if_statement) @local.scope
|
||||
(if_statement
|
||||
consequence: (_) @scope) ; if body in case there are no braces
|
||||
consequence: (_) @local.scope) ; if body in case there are no braces
|
||||
(if_statement
|
||||
alternative: (_) @scope) ; else body in case there are no braces
|
||||
alternative: (_) @local.scope) ; else body in case there are no braces
|
||||
|
||||
; try/catch
|
||||
|
||||
(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
(catch_clause) @scope ; needed because `Exception` variable
|
||||
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
(catch_clause) @local.scope ; needed because `Exception` variable
|
||||
|
||||
; loops
|
||||
|
||||
(for_statement) @scope
|
||||
(for_statement) @local.scope
|
||||
(for_statement ; "for" body in case there are no braces
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
(do_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
(while_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
|
||||
; Functions
|
||||
|
||||
(constructor_declaration) @scope
|
||||
(method_declaration) @scope
|
||||
(constructor_declaration) @local.scope
|
||||
(method_declaration) @local.scope
|
||||
|
||||
;; definitions
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @definition.enum)
|
||||
name: (identifier) @local.definition.enum)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_variable_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @definition.var))
|
||||
name: (identifier) @local.definition.var))
|
||||
|
||||
(enhanced_for_statement
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(catch_formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @definition.field))
|
||||
name: (identifier) @local.definition.field))
|
||||
|
||||
;; REFERENCES
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
(type_identifier) @reference
|
||||
(type_identifier) @local.reference
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
; Scopes
|
||||
(function_definition) @scope
|
||||
(function_definition) @local.scope
|
||||
|
||||
; Definitions
|
||||
(variable_assignment
|
||||
name: (variable_name) @definition.var)
|
||||
name: (variable_name) @local.definition.var)
|
||||
|
||||
(function_definition
|
||||
name: (word) @definition.function)
|
||||
name: (word) @local.definition.function)
|
||||
|
||||
; References
|
||||
(variable_name) @reference
|
||||
(word) @reference
|
||||
(variable_name) @local.reference
|
||||
(word) @local.reference
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(symbol) @reference
|
||||
(symbol) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
((list
|
||||
. (symbol) @_fnkw
|
||||
. (symbol) @definition.function
|
||||
(symbol)? @definition.parameter)
|
||||
. (symbol) @local.definition.function
|
||||
(symbol)? @local.definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
. (symbol) @_fnkw
|
||||
. (symbol) @definition.function
|
||||
(symbol)? @definition.parameter)
|
||||
. (symbol) @local.definition.function
|
||||
(symbol)? @local.definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
|
|
|
@ -13,62 +13,62 @@
|
|||
(array)
|
||||
(object)
|
||||
(interpolation)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(property_identifier) @reference
|
||||
(property_identifier) @local.reference
|
||||
|
||||
(call_expression
|
||||
(identifier) @reference)
|
||||
(identifier) @local.reference)
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @reference)
|
||||
(identifier) @local.reference)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @reference)
|
||||
(identifier) @local.reference)
|
||||
|
||||
; Definitions
|
||||
|
||||
(type) @definition.associated
|
||||
(type) @local.definition.associated
|
||||
|
||||
(object_property
|
||||
(identifier) @definition.field
|
||||
(identifier) @local.definition.field
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @definition.field
|
||||
(compatible_identifier) @local.definition.field
|
||||
(_))
|
||||
|
||||
(import_name) @definition.import
|
||||
(import_name) @local.definition.import
|
||||
|
||||
(module_declaration
|
||||
(identifier) @definition.namespace)
|
||||
(identifier) @local.definition.namespace)
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @definition.parameter
|
||||
(identifier) @local.definition.parameter
|
||||
(_))
|
||||
|
||||
(type_declaration
|
||||
(identifier) @definition.type
|
||||
(identifier) @local.definition.type
|
||||
(_))
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @definition.var
|
||||
(loop_enumerator) @definition.var))
|
||||
(loop_variable) @local.definition.var
|
||||
(loop_enumerator) @local.definition.var))
|
||||
|
|
|
@ -2,98 +2,98 @@
|
|||
[
|
||||
(python_identifier)
|
||||
(identifier)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (python_identifier) @definition.import)
|
||||
alias: (python_identifier) @local.definition.import)
|
||||
(import_statement
|
||||
name: (dotted_name ((python_identifier) @definition.import)))
|
||||
name: (dotted_name ((python_identifier) @local.definition.import)))
|
||||
(import_from_statement
|
||||
name: (dotted_name ((python_identifier) @definition.import)))
|
||||
name: (dotted_name ((python_identifier) @local.definition.import)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(default_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
; *args parameter
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
(python_identifier) @definition.parameter))
|
||||
(python_identifier) @local.definition.parameter))
|
||||
|
||||
; **kwargs parameter
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
(python_identifier) @definition.parameter))
|
||||
(python_identifier) @local.definition.parameter))
|
||||
|
||||
; Function defines function and scope
|
||||
((python_function_definition
|
||||
name: (python_identifier) @definition.function) @scope
|
||||
name: (python_identifier) @local.definition.function) @local.scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(function_definition (identifier) @definition.function)
|
||||
(function_definition (identifier) @local.definition.function)
|
||||
|
||||
(anonymous_python_function (identifier) @definition.function)
|
||||
(anonymous_python_function (identifier) @local.definition.function)
|
||||
|
||||
;;; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
(for_statement
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
(for_statement
|
||||
left: (python_identifier) @definition.var)
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
; not a scope!
|
||||
;(while_statement) @scope
|
||||
;(while_statement) @local.scope
|
||||
|
||||
; for in list comprehension
|
||||
(for_in_clause
|
||||
left: (python_identifier) @definition.var)
|
||||
left: (python_identifier) @local.definition.var)
|
||||
(for_in_clause
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
(for_in_clause
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @scope
|
||||
(list_comprehension) @scope
|
||||
(set_comprehension) @scope
|
||||
(dictionary_comprehension) @local.scope
|
||||
(list_comprehension) @local.scope
|
||||
(set_comprehension) @local.scope
|
||||
|
||||
;;; Assignments
|
||||
|
||||
(assignment
|
||||
left: (python_identifier) @definition.var)
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
(assignment
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @definition.field))
|
||||
(python_identifier) @local.definition.field))
|
||||
|
||||
(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @definition.var)
|
||||
(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var)
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
(python_identifier) @definition.var)
|
||||
(python_identifier) @local.definition.var)
|
||||
|
||||
(as_pattern
|
||||
alias: (as_pattern_target) @definition.var)
|
||||
alias: (as_pattern_target) @local.definition.var)
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
;; Functions definitions
|
||||
(function_declarator
|
||||
declarator: (identifier) @definition.function)
|
||||
declarator: (identifier) @local.definition.function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @definition.macro) @scope
|
||||
name: (identifier) @local.definition.macro) @local.scope
|
||||
|
||||
(preproc_def
|
||||
name: (identifier) @definition.macro)
|
||||
name: (identifier) @local.definition.macro)
|
||||
(pointer_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @definition.parameter)
|
||||
declarator: (identifier) @local.definition.parameter)
|
||||
(init_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
(array_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
(declaration
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
(enum_specifier
|
||||
name: (_) @definition.type
|
||||
name: (_) @local.definition.type
|
||||
(enumerator_list
|
||||
(enumerator name: (identifier) @definition.var)))
|
||||
(enumerator name: (identifier) @local.definition.var)))
|
||||
|
||||
;; Type / Struct / Enum
|
||||
(field_declaration
|
||||
declarator: (field_identifier) @definition.field)
|
||||
declarator: (field_identifier) @local.definition.field)
|
||||
(type_definition
|
||||
declarator: (type_identifier) @definition.type)
|
||||
declarator: (type_identifier) @local.definition.type)
|
||||
(struct_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
;; goto
|
||||
(labeled_statement (statement_identifier) @definition)
|
||||
(labeled_statement (statement_identifier) @local.definition)
|
||||
|
||||
;; References
|
||||
(identifier) @reference
|
||||
((field_identifier) @reference
|
||||
(identifier) @local.reference
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
((type_identifier) @reference
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(goto_statement (statement_identifier) @reference)
|
||||
(goto_statement (statement_identifier) @local.reference)
|
||||
|
||||
;; Scope
|
||||
[
|
||||
|
@ -50,4 +50,4 @@
|
|||
(function_definition)
|
||||
(compound_statement) ; a block in curly braces
|
||||
(struct_specifier)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
;; Definitions
|
||||
(variable_declarator
|
||||
. (identifier) @definition.var)
|
||||
. (identifier) @local.definition.var)
|
||||
|
||||
(variable_declarator
|
||||
(tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(declaration_expression
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(for_each_statement
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(for_each_statement
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @definition)
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(type_parameter
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @definition)
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
;; References
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
;; Scope
|
||||
(block) @scope
|
||||
(block) @local.scope
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
; References
|
||||
|
||||
(identifier) @reference
|
||||
((type_identifier) @reference
|
||||
(identifier) @local.reference
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
((field_identifier) @reference
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
; Scopes
|
||||
|
@ -20,49 +20,49 @@
|
|||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @definition.import))
|
||||
name: (identifier) @local.definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @definition.import)
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
||||
(use_list
|
||||
(identifier) @definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
|
||||
; Functions
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.function)
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.method
|
||||
(identifier) @local.definition.method
|
||||
(parameter (self)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
|
||||
(parameter
|
||||
[ (identifier) (self) ] @definition.parameter)
|
||||
[ (identifier) (self) ] @local.definition.parameter)
|
||||
|
||||
; Types
|
||||
|
||||
(struct_item
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
; Module
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @definition.namespace)
|
||||
name: (identifier) @local.definition.namespace)
|
||||
|
||||
; Variables
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
|
|
@ -12,79 +12,79 @@
|
|||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
[
|
||||
(extend_type)
|
||||
(field_type)
|
||||
] @reference
|
||||
(custom_type (type_identifier) @reference)
|
||||
] @local.reference
|
||||
(custom_type (type_identifier) @local.reference)
|
||||
(custom_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @reference)))
|
||||
(generic_identifier) @local.reference)))
|
||||
|
||||
(annotation_definition_identifier) @definition
|
||||
(annotation_definition_identifier) @local.definition
|
||||
|
||||
(const_identifier) @definition.constant
|
||||
(const_identifier) @local.definition.constant
|
||||
|
||||
(enum (enum_identifier) @definition.enum)
|
||||
(enum (enum_identifier) @local.definition.enum)
|
||||
|
||||
[
|
||||
(enum_member)
|
||||
(field_identifier)
|
||||
] @definition.field
|
||||
] @local.definition.field
|
||||
|
||||
(method_identifier) @definition.method
|
||||
(method_identifier) @local.definition.method
|
||||
|
||||
(namespace) @definition.namespace
|
||||
(namespace) @local.definition.namespace
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @definition.parameter
|
||||
] @local.definition.parameter
|
||||
|
||||
(group (type_identifier) @definition.type)
|
||||
(group (type_identifier) @local.definition.type)
|
||||
|
||||
(struct (type_identifier) @definition.type)
|
||||
(struct (type_identifier) @local.definition.type)
|
||||
|
||||
(union (type_identifier) @definition.type)
|
||||
(union (type_identifier) @local.definition.type)
|
||||
|
||||
(interface (type_identifier) @definition.type)
|
||||
(interface (type_identifier) @local.definition.type)
|
||||
|
||||
; Generics Related (don't know how to combine these)
|
||||
|
||||
(struct
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(interface
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(method
|
||||
(implicit_generics
|
||||
(implicit_generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(method
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(annotation
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
(replace_using
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
(return_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
;; Definitions
|
||||
|
||||
(intent_def (intent) @definition)
|
||||
(slot_def (slot) @definition)
|
||||
(alias_def (alias) @definition)
|
||||
(intent_def (intent) @local.definition)
|
||||
(slot_def (slot) @local.definition)
|
||||
(alias_def (alias) @local.definition)
|
||||
|
||||
;; References
|
||||
|
||||
(slot_ref (slot) @reference)
|
||||
(alias_ref (alias) @reference)
|
||||
(slot_ref (slot) @local.reference)
|
||||
(alias_ref (alias) @local.reference)
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
|
||||
(defun_header
|
||||
function_name: (sym_lit) @definition.function (#set! definition.function.scope "parent"))
|
||||
function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent"))
|
||||
(defun_header
|
||||
lambda_list: (list_lit (sym_lit) @definition.parameter))
|
||||
lambda_list: (list_lit (sym_lit) @local.definition.parameter))
|
||||
|
||||
(defun_header
|
||||
keyword: (defun_keyword "defmethod")
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @definition.type)))
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @local.definition.type)))
|
||||
(defun_header
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) @definition.parameter . (_))))
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) @local.definition.parameter . (_))))
|
||||
|
||||
(sym_lit) @reference
|
||||
(sym_lit) @local.reference
|
||||
|
||||
(defun) @scope
|
||||
(defun) @local.scope
|
||||
|
||||
((list_lit . (sym_lit) @_defvar . (sym_lit) @definition.var)
|
||||
((list_lit . (sym_lit) @_defvar . (sym_lit) @local.definition.var)
|
||||
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @definition.function
|
||||
(#eq? @_deftest "deftest")) @scope
|
||||
(sym_lit) @local.definition.function
|
||||
(#eq? @_deftest "deftest")) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @definition.function
|
||||
(#eq? @_deftest "deftest")) @scope
|
||||
(sym_lit) @local.definition.function
|
||||
(#eq? @_deftest "deftest")) @local.scope
|
||||
|
||||
(for_clause . (sym_lit) @definition.var)
|
||||
(with_clause . (sym_lit) @definition.var)
|
||||
(loop_macro) @scope
|
||||
(for_clause . (sym_lit) @local.definition.var)
|
||||
(with_clause . (sym_lit) @local.definition.var)
|
||||
(loop_macro) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
|
||||
.
|
||||
(list_lit (list_lit . (sym_lit) @definition.var))) @scope
|
||||
(list_lit (list_lit . (sym_lit) @local.definition.var))) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
|
||||
.
|
||||
(list_lit . (sym_lit) @definition.var)) @scope
|
||||
(list_lit . (sym_lit) @local.definition.var)) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(kwd_lit (kwd_symbol) @definition.import))
|
||||
(kwd_lit (kwd_symbol) @local.definition.import))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(sym_lit) @definition.import)
|
||||
(sym_lit) @local.definition.import)
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_use (#eq? @_use ":use")
|
||||
(kwd_lit (kwd_symbol) @definition.import))
|
||||
(kwd_lit (kwd_symbol) @local.definition.import))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_use (#eq? @_use ":use")
|
||||
(sym_lit) @definition.import)
|
||||
(sym_lit) @local.definition.import)
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
[
|
||||
(object)
|
||||
(array)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; definitions
|
||||
|
||||
(assign_block
|
||||
(assignment
|
||||
(input)
|
||||
@definition.constant))
|
||||
@local.definition.constant))
|
||||
|
||||
(value (input) @reference)
|
||||
(value (input) @local.reference)
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
(meta_map)
|
||||
(map)
|
||||
(array)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -3,73 +3,73 @@
|
|||
;; Parameters
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
(optional_parameter_declaration
|
||||
declarator: (identifier) @definition.parameter)
|
||||
declarator: (identifier) @local.definition.parameter)
|
||||
;; Class / struct definitions
|
||||
(class_specifier) @scope
|
||||
(class_specifier) @local.scope
|
||||
|
||||
(reference_declarator
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(variadic_declarator
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(struct_specifier
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @definition.type))
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
(class_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
(concept_definition
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
(class_specifier
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @definition.type))
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
(alias_declaration
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
;template <typename T>
|
||||
(type_parameter_declaration
|
||||
(type_identifier) @definition.type)
|
||||
(template_declaration) @scope
|
||||
(type_identifier) @local.definition.type)
|
||||
(template_declaration) @local.scope
|
||||
|
||||
;; Namespaces
|
||||
(namespace_definition
|
||||
name: (namespace_identifier) @definition.namespace
|
||||
body: (_) @scope)
|
||||
name: (namespace_identifier) @local.definition.namespace
|
||||
body: (_) @local.scope)
|
||||
|
||||
(namespace_definition
|
||||
name: (nested_namespace_specifier) @definition.namespace
|
||||
body: (_) @scope)
|
||||
name: (nested_namespace_specifier) @local.definition.namespace
|
||||
body: (_) @local.scope)
|
||||
|
||||
((namespace_identifier) @reference
|
||||
((namespace_identifier) @local.reference
|
||||
(#set! reference.kind "namespace"))
|
||||
|
||||
;; Function definitions
|
||||
(template_function
|
||||
name: (identifier) @definition.function) @scope
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
|
||||
(template_method
|
||||
name: (field_identifier) @definition.method) @scope
|
||||
name: (field_identifier) @local.definition.method) @local.scope
|
||||
|
||||
(function_declarator
|
||||
declarator: (qualified_identifier
|
||||
name: (identifier) @definition.function)) @scope
|
||||
name: (identifier) @local.definition.function)) @local.scope
|
||||
|
||||
(field_declaration
|
||||
declarator: (function_declarator
|
||||
(field_identifier) @definition.method))
|
||||
(field_identifier) @local.definition.method))
|
||||
|
||||
(lambda_expression) @scope
|
||||
(lambda_expression) @local.scope
|
||||
|
||||
;; Control structures
|
||||
(try_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
|
||||
(catch_clause) @scope
|
||||
(catch_clause) @local.scope
|
||||
|
||||
(requires_expression) @scope
|
||||
(requires_expression) @local.scope
|
||||
|
|
|
@ -4,31 +4,31 @@
|
|||
(source_file)
|
||||
(field)
|
||||
(for_clause)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(import_spec
|
||||
path: (string) @definition.import)
|
||||
path: (string) @local.definition.import)
|
||||
|
||||
(field
|
||||
(label
|
||||
(identifier) @definition.field))
|
||||
(identifier) @local.definition.field))
|
||||
|
||||
(package_identifier) @definition.namespace
|
||||
(package_identifier) @local.definition.namespace
|
||||
|
||||
(for_clause
|
||||
(identifier) @definition.variable
|
||||
(identifier) @local.definition.variable
|
||||
(expression))
|
||||
|
||||
(for_clause
|
||||
(identifier)
|
||||
(identifier) @definition.variable
|
||||
(identifier) @local.definition.variable
|
||||
(expression))
|
||||
|
||||
(let_clause
|
||||
(identifier) @definition.variable)
|
||||
(identifier) @local.definition.variable)
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
;; Definitions
|
||||
|
||||
(function_signature
|
||||
name: (identifier) @definition.function)
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(initialized_variable_definition
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(initialized_identifier
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(static_final_declaration
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
;; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
;; Scopes
|
||||
|
||||
(class_definition
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
[
|
||||
(block)
|
||||
(if_statement)
|
||||
|
@ -31,4 +31,4 @@
|
|||
(try_statement)
|
||||
(catch_clause)
|
||||
(finally_clause)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[
|
||||
(node)
|
||||
(integer_cells)
|
||||
]@scope
|
||||
]@local.scope
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(elementdecl (Name) @definition.type)
|
||||
(elementdecl (Name) @local.definition.type)
|
||||
|
||||
(elementdecl
|
||||
(contentspec
|
||||
(children (Name) @reference)))
|
||||
(children (Name) @local.reference)))
|
||||
|
||||
(AttlistDecl . (Name) @reference)
|
||||
(AttlistDecl . (Name) @local.reference)
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
; Scopes
|
||||
;-------
|
||||
|
||||
(statement_block) @scope
|
||||
(function) @scope
|
||||
(arrow_function) @scope
|
||||
(function_declaration) @scope
|
||||
(method_definition) @scope
|
||||
(for_statement) @scope
|
||||
(for_in_statement) @scope
|
||||
(catch_clause) @scope
|
||||
(statement_block) @local.scope
|
||||
(function) @local.scope
|
||||
(arrow_function) @local.scope
|
||||
(function_declaration) @local.scope
|
||||
(method_definition) @local.scope
|
||||
(for_statement) @local.scope
|
||||
(for_in_statement) @local.scope
|
||||
(catch_clause) @local.scope
|
||||
|
||||
; Definitions
|
||||
;------------
|
||||
|
||||
(variable_declarator
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(import_specifier
|
||||
(identifier) @definition.import)
|
||||
(identifier) @local.definition.import)
|
||||
|
||||
(namespace_import
|
||||
(identifier) @definition.import)
|
||||
(identifier) @local.definition.import)
|
||||
|
||||
(function_declaration
|
||||
((identifier) @definition.function)
|
||||
((identifier) @local.definition.function)
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(method_definition
|
||||
((property_identifier) @definition.function)
|
||||
((property_identifier) @local.definition.function)
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
; References
|
||||
;------------
|
||||
|
||||
(identifier) @reference
|
||||
(shorthand_property_identifier) @reference
|
||||
(identifier) @local.reference
|
||||
(shorthand_property_identifier) @local.reference
|
||||
|
|
|
@ -1,86 +1,86 @@
|
|||
; References
|
||||
(identifier) @reference
|
||||
(alias) @reference
|
||||
(identifier) @local.reference
|
||||
(alias) @local.reference
|
||||
|
||||
; Module Definitions
|
||||
(call
|
||||
target: ((identifier) @_identifier (#eq? @_identifier "defmodule"))
|
||||
(arguments (alias) @definition.type))
|
||||
(arguments (alias) @local.definition.type))
|
||||
|
||||
; Pattern Match Definitions
|
||||
(binary_operator left: [
|
||||
(identifier) @definition.var
|
||||
(_ (identifier) @definition.var)
|
||||
(_ (_ (identifier) @definition.var))
|
||||
(_ (_ (_ (identifier) @definition.var)))
|
||||
(_ (_ (_ (_ (identifier) @definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier) @definition.var)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))))
|
||||
(identifier) @local.definition.var
|
||||
(_ (identifier) @local.definition.var)
|
||||
(_ (_ (identifier) @local.definition.var))
|
||||
(_ (_ (_ (identifier) @local.definition.var)))
|
||||
(_ (_ (_ (_ (identifier) @local.definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier) @local.definition.var)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))))
|
||||
] operator: "=")
|
||||
|
||||
; Stab Clause Definitions
|
||||
(stab_clause
|
||||
left: [
|
||||
(arguments [
|
||||
(identifier) @definition.var
|
||||
(_ (identifier) @definition.var)
|
||||
(_ (_ (identifier) @definition.var))
|
||||
(_ (_ (_ (identifier) @definition.var)))
|
||||
(_ (_ (_ (_ (identifier) @definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier) @definition.var)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))))
|
||||
(identifier) @local.definition.var
|
||||
(_ (identifier) @local.definition.var)
|
||||
(_ (_ (identifier) @local.definition.var))
|
||||
(_ (_ (_ (identifier) @local.definition.var)))
|
||||
(_ (_ (_ (_ (identifier) @local.definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier) @local.definition.var)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))))
|
||||
])
|
||||
(binary_operator
|
||||
left: (arguments [
|
||||
(identifier) @definition.var
|
||||
(_ (identifier) @definition.var)
|
||||
(_ (_ (identifier) @definition.var))
|
||||
(_ (_ (_ (identifier) @definition.var)))
|
||||
(_ (_ (_ (_ (identifier) @definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier) @definition.var)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))))
|
||||
(identifier) @local.definition.var
|
||||
(_ (identifier) @local.definition.var)
|
||||
(_ (_ (identifier) @local.definition.var))
|
||||
(_ (_ (_ (identifier) @local.definition.var)))
|
||||
(_ (_ (_ (_ (identifier) @local.definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier) @local.definition.var)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))))
|
||||
]) operator: "when")
|
||||
])
|
||||
|
||||
|
@ -88,11 +88,11 @@
|
|||
(call
|
||||
target: ((identifier) @_identifier (#any-of? @_identifier "require" "alias" "use" "import"))
|
||||
(arguments [
|
||||
(alias) @definition.import
|
||||
(_ (alias) @definition.import)
|
||||
(_ (_ (alias) @definition.import))
|
||||
(_ (_ (_ (alias) @definition.import)))
|
||||
(_ (_ (_ (_ (alias) @definition.import))))
|
||||
(alias) @local.definition.import
|
||||
(_ (alias) @local.definition.import)
|
||||
(_ (_ (alias) @local.definition.import))
|
||||
(_ (_ (_ (alias) @local.definition.import)))
|
||||
(_ (_ (_ (_ (alias) @local.definition.import))))
|
||||
]
|
||||
))
|
||||
|
||||
|
@ -100,35 +100,35 @@
|
|||
(call
|
||||
target: ((identifier) @_identifier (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for"))
|
||||
(arguments [
|
||||
(identifier) @definition.function
|
||||
(binary_operator left: (identifier) @definition.function operator: "when")
|
||||
(binary_operator (identifier) @definition.parameter)
|
||||
(call target: (identifier) @definition.function (arguments [
|
||||
(identifier) @definition.parameter
|
||||
(_ (identifier) @definition.parameter)
|
||||
(_ (_ (identifier) @definition.parameter))
|
||||
(_ (_ (_ (identifier) @definition.parameter)))
|
||||
(_ (_ (_ (_ (identifier) @definition.parameter))))
|
||||
(_ (_ (_ (_ (_ (identifier) @definition.parameter)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))))
|
||||
(identifier) @local.definition.function
|
||||
(binary_operator left: (identifier) @local.definition.function operator: "when")
|
||||
(binary_operator (identifier) @local.definition.parameter)
|
||||
(call target: (identifier) @local.definition.function (arguments [
|
||||
(identifier) @local.definition.parameter
|
||||
(_ (identifier) @local.definition.parameter)
|
||||
(_ (_ (identifier) @local.definition.parameter))
|
||||
(_ (_ (_ (identifier) @local.definition.parameter)))
|
||||
(_ (_ (_ (_ (identifier) @local.definition.parameter))))
|
||||
(_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))))
|
||||
]))
|
||||
]?) (#set! definition.function.scope parent)
|
||||
(do_block)?
|
||||
) @scope
|
||||
) @local.scope
|
||||
|
||||
; ExUnit Test Definitions & Scopes
|
||||
(call
|
||||
|
@ -136,29 +136,29 @@
|
|||
(arguments [
|
||||
(string)
|
||||
((string) . "," . [
|
||||
(identifier) @definition.parameter
|
||||
(_ (identifier) @definition.parameter)
|
||||
(_ (_ (identifier) @definition.parameter))
|
||||
(_ (_ (_ (identifier) @definition.parameter)))
|
||||
(_ (_ (_ (_ (identifier) @definition.parameter))))
|
||||
(_ (_ (_ (_ (_ (identifier) @definition.parameter)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))))
|
||||
(identifier) @local.definition.parameter
|
||||
(_ (identifier) @local.definition.parameter)
|
||||
(_ (_ (identifier) @local.definition.parameter))
|
||||
(_ (_ (_ (identifier) @local.definition.parameter)))
|
||||
(_ (_ (_ (_ (identifier) @local.definition.parameter))))
|
||||
(_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))
|
||||
(_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))
|
||||
(_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))))
|
||||
])
|
||||
]) (do_block)?) @scope
|
||||
]) (do_block)?) @local.scope
|
||||
|
||||
; Stab Clause Scopes
|
||||
(stab_clause) @scope
|
||||
(stab_clause) @local.scope
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
[
|
||||
(source_file)
|
||||
(reduction)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
(function) @definition.function
|
||||
(function) @local.definition.function
|
||||
|
||||
(method) @definition.method
|
||||
(method) @local.definition.method
|
||||
|
||||
(parameter) @definition.parameter
|
||||
(parameter) @local.definition.parameter
|
||||
|
|
|
@ -6,21 +6,21 @@
|
|||
(each)
|
||||
(for)
|
||||
(match)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(
|
||||
(list . (symbol) @_special) @scope
|
||||
(list . (symbol) @_special) @local.scope
|
||||
(#any-of? @_special
|
||||
"while" "if" "when" "do" "collect" "icollect" "accumulate")
|
||||
)
|
||||
|
||||
(fn name: (symbol) @definition.function
|
||||
(fn name: (symbol) @local.definition.function
|
||||
(#set! definition.function.scope "parent"))
|
||||
(lambda name: (symbol) @definition.function
|
||||
(lambda name: (symbol) @local.definition.function
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
; TODO: use @definition.parameter for parameters
|
||||
(binding (symbol) @definition.var)
|
||||
(for_clause . (symbol) @definition.var)
|
||||
; TODO: use @local.definition.parameter for parameters
|
||||
(binding (symbol) @local.definition.var)
|
||||
(for_clause . (symbol) @local.definition.var)
|
||||
|
||||
(symbol) @reference
|
||||
(symbol) @local.reference
|
||||
|
|
|
@ -7,32 +7,32 @@
|
|||
|
||||
(else)
|
||||
(when)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(port (identifier) @definition.field)
|
||||
(port (identifier) @local.definition.field)
|
||||
|
||||
(wire (identifier) @definition.field)
|
||||
(wire (identifier) @local.definition.field)
|
||||
|
||||
(cmem (identifier) @definition.field)
|
||||
(cmem (identifier) @local.definition.field)
|
||||
|
||||
(smem (identifier) @definition.field)
|
||||
(smem (identifier) @local.definition.field)
|
||||
|
||||
(memory (identifier) @definition.field)
|
||||
(memory (identifier) @local.definition.field)
|
||||
|
||||
(register (identifier) @definition.field)
|
||||
(register (identifier) @local.definition.field)
|
||||
|
||||
(circuit (identifier) @definition.namespace)
|
||||
(circuit (identifier) @local.definition.namespace)
|
||||
|
||||
(module (identifier) @definition.namespace)
|
||||
(module (identifier) @local.definition.namespace)
|
||||
|
||||
(parameter (identifier) @definition.parameter)
|
||||
(parameter (identifier) @local.definition.parameter)
|
||||
|
||||
(rdwr (identifier) @definition.var)
|
||||
(rdwr (identifier) @local.definition.var)
|
||||
|
||||
(node (identifier) @definition.var)
|
||||
(node (identifier) @local.definition.var)
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
(begin_statement)
|
||||
(while_statement)
|
||||
(switch_statement)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
;; Definitions
|
||||
(function_definition
|
||||
name: (word) @definition.function)
|
||||
name: (word) @local.definition.function)
|
||||
|
||||
;; References
|
||||
(variable_name) @reference
|
||||
(word) @reference
|
||||
(variable_name) @local.reference
|
||||
(word) @local.reference
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(dict) @scope
|
||||
(dict) @local.scope
|
||||
|
||||
(dict key: (_) @definition.type)
|
||||
(dict key: (_) @local.definition.type)
|
||||
|
||||
(key_value keyword: (_) @definition.parameter)
|
||||
(key_value value: (macro (identifier)*)* @reference)
|
||||
(key_value keyword: (_) @local.definition.parameter)
|
||||
(key_value value: (macro (identifier)*)* @local.reference)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
(word) @reference
|
||||
(word) @local.reference
|
||||
|
||||
(word_definition) @scope
|
||||
(word_definition) @local.scope
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
;; Fusion base
|
||||
(block) @scope
|
||||
(block) @local.scope
|
||||
|
||||
(namespace_declaration
|
||||
(alias_namespace) @definition.namespace)
|
||||
(alias_namespace) @local.definition.namespace)
|
||||
|
||||
(property
|
||||
(path (path_part) @definition.field))
|
||||
(path (path_part) @local.definition.field))
|
||||
|
||||
(type
|
||||
namespace: (package_name)? @definition.namespace
|
||||
name: (type_name) @definition.type
|
||||
namespace: (package_name)? @local.definition.namespace
|
||||
name: (type_name) @local.definition.type
|
||||
)
|
||||
|
||||
;; Eel Expressions
|
||||
(eel_arrow_function) @scope
|
||||
(eel_object) @scope
|
||||
(eel_arrow_function) @local.scope
|
||||
(eel_object) @local.scope
|
||||
|
||||
(eel_parameter) @definition.parameter
|
||||
(eel_parameter) @local.definition.parameter
|
||||
(eel_object_pair
|
||||
key: (eel_property_name) @definition.field)
|
||||
key: (eel_property_name) @local.definition.field)
|
||||
|
|
|
@ -14,79 +14,79 @@
|
|||
(lambda)
|
||||
(get_body)
|
||||
(set_body)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
;; Parameters
|
||||
|
||||
(parameters (identifier) @definition.parameter)
|
||||
(default_parameter (identifier) @definition.parameter)
|
||||
(typed_parameter (identifier) @definition.parameter)
|
||||
(typed_default_parameter (identifier) @definition.parameter)
|
||||
(parameters (identifier) @local.definition.parameter)
|
||||
(default_parameter (identifier) @local.definition.parameter)
|
||||
(typed_parameter (identifier) @local.definition.parameter)
|
||||
(typed_default_parameter (identifier) @local.definition.parameter)
|
||||
|
||||
;; Signals
|
||||
|
||||
; Can gdscript 2 signals be considered fields?
|
||||
(signal_statement (name) @definition.field)
|
||||
(signal_statement (name) @local.definition.field)
|
||||
|
||||
;; Variable Definitions
|
||||
|
||||
(const_statement (name) @definition.constant)
|
||||
(const_statement (name) @local.definition.constant)
|
||||
; onready and export variations are only properties.
|
||||
(variable_statement (name) @definition.var)
|
||||
(variable_statement (name) @local.definition.var)
|
||||
|
||||
(setter) @reference
|
||||
(getter) @reference
|
||||
(setter) @local.reference
|
||||
(getter) @local.reference
|
||||
|
||||
;; Function Definition
|
||||
|
||||
((function_definition (name) @definition.function)
|
||||
((function_definition (name) @local.definition.function)
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
;; Lambda
|
||||
|
||||
; lambda names are not accessible and are only for debugging.
|
||||
(lambda (name) @definition.function)
|
||||
(lambda (name) @local.definition.function)
|
||||
|
||||
;; Source
|
||||
|
||||
(class_name_statement (name) @definition.type)
|
||||
(class_name_statement (name) @local.definition.type)
|
||||
|
||||
(source (variable_statement (name) @definition.field))
|
||||
(source (onready_variable_statement (name) @definition.field))
|
||||
(source (export_variable_statement (name) @definition.field))
|
||||
(source (variable_statement (name) @local.definition.field))
|
||||
(source (onready_variable_statement (name) @local.definition.field))
|
||||
(source (export_variable_statement (name) @local.definition.field))
|
||||
|
||||
;; Class
|
||||
|
||||
((class_definition (name) @definition.type)
|
||||
((class_definition (name) @local.definition.type)
|
||||
(#set! "definition.type.scope" "parent"))
|
||||
|
||||
(class_definition
|
||||
(body (variable_statement (name) @definition.field)))
|
||||
(body (variable_statement (name) @local.definition.field)))
|
||||
(class_definition
|
||||
(body (onready_variable_statement (name) @definition.field)))
|
||||
(body (onready_variable_statement (name) @local.definition.field)))
|
||||
(class_definition
|
||||
(body (export_variable_statement (name) @definition.field)))
|
||||
(body (export_variable_statement (name) @local.definition.field)))
|
||||
(class_definition
|
||||
(body (signal_statement (name) @definition.field)))
|
||||
(body (signal_statement (name) @local.definition.field)))
|
||||
|
||||
; Although a script is also a class, let's only define functions in an inner class as
|
||||
; methods.
|
||||
((class_definition
|
||||
(body (function_definition (name) @definition.method)))
|
||||
(body (function_definition (name) @local.definition.method)))
|
||||
(#set! "definition.method.scope" "parent"))
|
||||
|
||||
;; Enum
|
||||
|
||||
((enum_definition (name) @definition.enum))
|
||||
((enum_definition (name) @local.definition.enum))
|
||||
|
||||
;; Repeat
|
||||
|
||||
(for_statement . (identifier) @definition.var)
|
||||
(for_statement . (identifier) @local.definition.var)
|
||||
|
||||
;; Match Statement
|
||||
|
||||
(pattern_binding (identifier) @definition.var)
|
||||
(pattern_binding (identifier) @local.definition.var)
|
||||
|
||||
;; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(macro_def (attr_name) @definition.macro)
|
||||
(macro_def (attr_name) @local.definition.macro)
|
||||
|
||||
(attribute (attr_name) @reference)
|
||||
(attribute (builtin_attr) @reference)
|
||||
(attribute (attr_name) @local.reference)
|
||||
(attribute (builtin_attr) @local.reference)
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
; Let Binding Definition
|
||||
(let pattern: (identifier) @definition)
|
||||
(let pattern: (identifier) @local.definition)
|
||||
|
||||
; List Pattern Definitions
|
||||
(list_pattern (identifier) @definition)
|
||||
(list_pattern assign: (identifier) @definition)
|
||||
(list_pattern (identifier) @local.definition)
|
||||
(list_pattern assign: (identifier) @local.definition)
|
||||
|
||||
; Tuple Pattern Definition
|
||||
(tuple_pattern (identifier) @definition)
|
||||
(tuple_pattern (identifier) @local.definition)
|
||||
|
||||
; Record Pattern Definition
|
||||
(record_pattern_argument pattern: (identifier) @definition)
|
||||
(record_pattern_argument pattern: (identifier) @local.definition)
|
||||
|
||||
; Function Parameter Definition
|
||||
(function_parameter name: (identifier) @definition)
|
||||
(function_parameter name: (identifier) @local.definition)
|
||||
|
||||
; References
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Function Body Scope
|
||||
(function_body) @scope
|
||||
(function_body) @local.scope
|
||||
|
||||
; Case Scope
|
||||
(case_clause) @scope
|
||||
(case_clause) @local.scope
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[
|
||||
(element_node)
|
||||
(block_statement)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(block_params (identifier) @definition.var)
|
||||
(identifier) @local.reference
|
||||
(block_params (identifier) @local.definition.var)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
(source_file)
|
||||
(block)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
(
|
||||
(function_declaration
|
||||
name: (identifier) @definition.function) ;@function
|
||||
name: (identifier) @local.definition.function) ;@function
|
||||
)
|
||||
|
||||
(
|
||||
(method_declaration
|
||||
name: (field_identifier) @definition.method); @method
|
||||
name: (field_identifier) @local.definition.method); @method
|
||||
)
|
||||
|
||||
(short_var_declaration
|
||||
left: (expression_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(var_spec
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(parameter_declaration (identifier) @definition.var)
|
||||
(variadic_parameter_declaration (identifier) @definition.var)
|
||||
(parameter_declaration (identifier) @local.definition.var)
|
||||
(variadic_parameter_declaration (identifier) @local.definition.var)
|
||||
|
||||
(for_statement
|
||||
(range_clause
|
||||
left: (expression_list
|
||||
(identifier) @definition.var)))
|
||||
(identifier) @local.definition.var)))
|
||||
|
||||
(const_declaration
|
||||
(const_spec
|
||||
name: (identifier) @definition.var))
|
||||
name: (identifier) @local.definition.var))
|
||||
|
||||
(type_declaration
|
||||
(type_spec
|
||||
name: (type_identifier) @definition.type))
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
;; reference
|
||||
(identifier) @reference
|
||||
(type_identifier) @reference
|
||||
(field_identifier) @reference
|
||||
((package_identifier) @reference
|
||||
(identifier) @local.reference
|
||||
(type_identifier) @local.reference
|
||||
(field_identifier) @local.reference
|
||||
((package_identifier) @local.reference
|
||||
(#set! reference.kind "namespace"))
|
||||
|
||||
(package_clause
|
||||
(package_identifier) @definition.namespace)
|
||||
(package_identifier) @local.definition.namespace)
|
||||
|
||||
(import_spec_list
|
||||
(import_spec
|
||||
name: (package_identifier) @definition.namespace))
|
||||
name: (package_identifier) @local.definition.namespace))
|
||||
|
||||
;; Call references
|
||||
((call_expression
|
||||
function: (identifier) @reference)
|
||||
function: (identifier) @local.reference)
|
||||
(#set! reference.kind "call" ))
|
||||
|
||||
((call_expression
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @reference))
|
||||
field: (field_identifier) @local.reference))
|
||||
(#set! reference.kind "call" ))
|
||||
|
||||
|
||||
((call_expression
|
||||
function: (parenthesized_expression
|
||||
(identifier) @reference))
|
||||
(identifier) @local.reference))
|
||||
(#set! reference.kind "call" ))
|
||||
|
||||
((call_expression
|
||||
function: (parenthesized_expression
|
||||
(selector_expression
|
||||
field: (field_identifier) @reference)))
|
||||
field: (field_identifier) @local.reference)))
|
||||
(#set! reference.kind "call" ))
|
||||
|
||||
;; Scopes
|
||||
|
||||
(func_literal) @scope
|
||||
(source_file) @scope
|
||||
(function_declaration) @scope
|
||||
(if_statement) @scope
|
||||
(block) @scope
|
||||
(expression_switch_statement) @scope
|
||||
(for_statement) @scope
|
||||
(method_declaration) @scope
|
||||
(func_literal) @local.scope
|
||||
(source_file) @local.scope
|
||||
(function_declaration) @local.scope
|
||||
(if_statement) @local.scope
|
||||
(block) @local.scope
|
||||
(expression_switch_statement) @local.scope
|
||||
(for_statement) @local.scope
|
||||
(method_declaration) @local.scope
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[
|
||||
(section)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -7,41 +7,41 @@
|
|||
(for_statement)
|
||||
(match_expression)
|
||||
(switch_expression)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(scoped_type_identifier)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(global_binding
|
||||
(identifier) @definition.constant . ":" (_))
|
||||
(identifier) @local.definition.constant . ":" (_))
|
||||
|
||||
(const_declaration
|
||||
"const" (identifier) @definition.constant . "=")
|
||||
"const" (identifier) @local.definition.constant . "=")
|
||||
|
||||
(field
|
||||
. (identifier) @definition.field)
|
||||
. (identifier) @local.definition.field)
|
||||
|
||||
(field_assignment
|
||||
. (identifier) @definition.field)
|
||||
. (identifier) @local.definition.field)
|
||||
|
||||
(function_declaration
|
||||
"fn" . (identifier) @definition.function)
|
||||
"fn" . (identifier) @local.definition.function)
|
||||
|
||||
(parameter
|
||||
(_) @definition.parameter . ":")
|
||||
(_) @local.definition.parameter . ":")
|
||||
|
||||
(type_declaration
|
||||
"type" (identifier) @definition.type . "=")
|
||||
"type" (identifier) @local.definition.type . "=")
|
||||
|
||||
(type_declaration
|
||||
"type" (identifier) @definition.enum . "=" (enum_type))
|
||||
"type" (identifier) @local.definition.enum . "=" (enum_type))
|
||||
|
||||
(let_declaration
|
||||
"let" . (identifier) @definition.variable ","?)
|
||||
"let" . (identifier) @local.definition.variable ","?)
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
(component_name)
|
||||
(slot_name)
|
||||
(tag_name)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Create a new scope within each HEEx tag, component, and slot
|
||||
[
|
||||
(component)
|
||||
(slot)
|
||||
(tag)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(tisfasTall
|
||||
name: (name) @definition.var)
|
||||
name: (name) @local.definition.var)
|
||||
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
|
|
|
@ -1 +1 @@
|
|||
(element) @scope
|
||||
(element) @local.scope
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
; inherits: c
|
||||
|
||||
(reference_declarator
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(type_parameter_declaration
|
||||
(type_identifier) @definition.type)
|
||||
(template_declaration) @scope
|
||||
(type_identifier) @local.definition.type)
|
||||
(template_declaration) @local.scope
|
||||
|
||||
(template_function
|
||||
name: (identifier) @definition.function) @scope
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
|
||||
[
|
||||
(foreach_statement)
|
||||
(foreach_instance_statement)
|
||||
(unmasked_statement)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -2,88 +2,88 @@
|
|||
|
||||
; declarations
|
||||
|
||||
(program) @scope
|
||||
(program) @local.scope
|
||||
(class_declaration
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
(record_declaration
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
(enum_declaration
|
||||
body: (_) @scope)
|
||||
(lambda_expression) @scope
|
||||
(enhanced_for_statement) @scope
|
||||
body: (_) @local.scope)
|
||||
(lambda_expression) @local.scope
|
||||
(enhanced_for_statement) @local.scope
|
||||
|
||||
; block
|
||||
|
||||
(block) @scope
|
||||
(block) @local.scope
|
||||
|
||||
; if/else
|
||||
|
||||
(if_statement) @scope ; if+else
|
||||
(if_statement) @local.scope ; if+else
|
||||
(if_statement
|
||||
consequence: (_) @scope) ; if body in case there are no braces
|
||||
consequence: (_) @local.scope) ; if body in case there are no braces
|
||||
(if_statement
|
||||
alternative: (_) @scope) ; else body in case there are no braces
|
||||
alternative: (_) @local.scope) ; else body in case there are no braces
|
||||
|
||||
; try/catch
|
||||
|
||||
(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
(catch_clause) @scope ; needed because `Exception` variable
|
||||
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
(catch_clause) @local.scope ; needed because `Exception` variable
|
||||
|
||||
; loops
|
||||
|
||||
(for_statement) @scope ; whole for_statement because loop iterator variable
|
||||
(for_statement) @local.scope ; whole for_statement because loop iterator variable
|
||||
(for_statement ; "for" body in case there are no braces
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
(do_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
(while_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
|
||||
; Functions
|
||||
|
||||
(constructor_declaration) @scope
|
||||
(method_declaration) @scope
|
||||
(constructor_declaration) @local.scope
|
||||
(method_declaration) @local.scope
|
||||
|
||||
;; DEFINITIONS
|
||||
|
||||
(package_declaration
|
||||
(identifier) @definition.namespace)
|
||||
(identifier) @local.definition.namespace)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
(record_declaration
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @definition.enum)
|
||||
name: (identifier) @local.definition.enum)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_variable_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @definition.var))
|
||||
name: (identifier) @local.definition.var))
|
||||
(enhanced_for_statement ; for (var item : items) {
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
(catch_formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
(inferred_parameters (identifier) @definition.parameter) ; (x,y) -> ...
|
||||
name: (identifier) @local.definition.parameter)
|
||||
(inferred_parameters (identifier) @local.definition.parameter) ; (x,y) -> ...
|
||||
(lambda_expression
|
||||
parameters: (identifier) @definition.parameter) ; x -> ...
|
||||
parameters: (identifier) @local.definition.parameter) ; x -> ...
|
||||
|
||||
((scoped_identifier
|
||||
(identifier) @definition.import)
|
||||
(#has-ancestor? @definition.import import_declaration))
|
||||
(identifier) @local.definition.import)
|
||||
(#has-ancestor? @local.definition.import import_declaration))
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @definition.field))
|
||||
name: (identifier) @local.definition.field))
|
||||
|
||||
;; REFERENCES
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
(type_identifier) @reference
|
||||
(type_identifier) @local.reference
|
||||
|
|
|
@ -7,45 +7,45 @@
|
|||
; this.quuz = "qux";
|
||||
; }
|
||||
(field_definition
|
||||
property: [(property_identifier) (private_property_identifier)] @definition.var)
|
||||
property: [(property_identifier) (private_property_identifier)] @local.definition.var)
|
||||
|
||||
; this.foo = "bar"
|
||||
(assignment_expression
|
||||
left: (member_expression
|
||||
object: (this)
|
||||
property: (property_identifier) @definition.var))
|
||||
property: (property_identifier) @local.definition.var))
|
||||
|
||||
(formal_parameters
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
; function(arg = []) {
|
||||
(formal_parameters
|
||||
(assignment_pattern
|
||||
left: (identifier) @definition.parameter))
|
||||
left: (identifier) @local.definition.parameter))
|
||||
|
||||
; x => x
|
||||
(arrow_function
|
||||
parameter: (identifier) @definition.parameter)
|
||||
parameter: (identifier) @local.definition.parameter)
|
||||
|
||||
;; ({ a }) => null
|
||||
(formal_parameters
|
||||
(object_pattern
|
||||
(shorthand_property_identifier_pattern) @definition.parameter))
|
||||
(shorthand_property_identifier_pattern) @local.definition.parameter))
|
||||
|
||||
;; ({ a: b }) => null
|
||||
(formal_parameters
|
||||
(object_pattern
|
||||
(pair_pattern
|
||||
value: (identifier) @definition.parameter)))
|
||||
value: (identifier) @local.definition.parameter)))
|
||||
|
||||
;; ([ a ]) => null
|
||||
(formal_parameters
|
||||
(array_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(formal_parameters
|
||||
(rest_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
; Both methods are matched here.
|
||||
;
|
||||
|
@ -54,10 +54,10 @@
|
|||
; baz(y) { y }
|
||||
; }
|
||||
(method_definition
|
||||
([(property_identifier) (private_property_identifier)] @definition.function)
|
||||
([(property_identifier) (private_property_identifier)] @local.definition.function)
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
; this.foo()
|
||||
(member_expression
|
||||
object: (this)
|
||||
property: (property_identifier) @reference)
|
||||
property: (property_identifier) @local.reference)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(funcdef (identifier) @definition.function)
|
||||
(funcdef (identifier) @local.definition.function)
|
||||
|
||||
(funcdefargs (identifier) @definition.parameter)
|
||||
(funcdefargs (identifier) @local.definition.parameter)
|
||||
|
||||
(funcname) @reference
|
||||
(funcname) @local.reference
|
||||
|
||||
(index (identifier) @reference)
|
||||
(index (identifier) @local.reference)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[
|
||||
(object)
|
||||
(array)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
(parenthesis) @scope
|
||||
(anonymous_function) @scope
|
||||
(object) @scope
|
||||
(field) @scope
|
||||
(local_bind) @scope
|
||||
(parenthesis) @local.scope
|
||||
(anonymous_function) @local.scope
|
||||
(object) @local.scope
|
||||
(field) @local.scope
|
||||
(local_bind) @local.scope
|
||||
|
||||
(field
|
||||
function: (fieldname (id) @definition.function)
|
||||
function: (fieldname (id) @local.definition.function)
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(bind (id) @definition.var)
|
||||
(bind function: (id) @definition.function)
|
||||
(bind (id) @local.definition.var)
|
||||
(bind function: (id) @local.definition.function)
|
||||
|
||||
(param (id) @definition.parameter)
|
||||
(param (id) @local.definition.parameter)
|
||||
|
||||
(id) @reference
|
||||
(id) @local.reference
|
||||
;(fieldname (id) (#is-not? local)) ; (#is-not?) not supported yet
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
;;; Variables
|
||||
(assignment
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
(assignment
|
||||
(tuple_expression
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
;;; let/const bindings
|
||||
(let_binding
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
(let_binding
|
||||
(tuple_expression
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
|
||||
;;; For bindings
|
||||
(for_binding
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
(for_binding
|
||||
(tuple_expression
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
|
||||
;;; Types
|
||||
|
||||
(struct_definition
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
(abstract_definition
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
(abstract_definition
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
;;; Module imports
|
||||
|
||||
(import_statement
|
||||
(identifier) @definition.import)
|
||||
(identifier) @local.definition.import)
|
||||
|
||||
|
||||
;;; Parameters
|
||||
|
||||
(parameter_list
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
(optional_parameter .
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
(slurp_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
parameter: (identifier) @definition.parameter
|
||||
parameter: (identifier) @local.definition.parameter
|
||||
(_))
|
||||
|
||||
(function_expression
|
||||
. (identifier) @definition.parameter) ;; Single parameter arrow function
|
||||
. (identifier) @local.definition.parameter) ;; Single parameter arrow function
|
||||
|
||||
|
||||
;;; Function/macro definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @definition.function) @scope
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
(short_function_definition
|
||||
name: (identifier) @definition.function) @scope
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
(macro_definition
|
||||
name: (identifier) @definition.macro) @scope
|
||||
name: (identifier) @local.definition.macro) @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
[
|
||||
(for_statement)
|
||||
|
@ -76,4 +76,4 @@
|
|||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[
|
||||
(symbol)
|
||||
(prompt)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
[
|
||||
(config)
|
||||
|
@ -10,8 +10,8 @@
|
|||
(comment_entry)
|
||||
(menu)
|
||||
(if)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(type_definition (prompt) @definition.var)
|
||||
(type_definition (input_prompt (prompt) @definition.var))
|
||||
(type_definition_default (expression (prompt) @definition.var))
|
||||
(type_definition (prompt) @local.definition.var)
|
||||
(type_definition (input_prompt (prompt) @local.definition.var))
|
||||
(type_definition_default (expression (prompt) @local.definition.var))
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(document) @scope
|
||||
(node (node_children) @scope)
|
||||
(node_children (node) @scope)
|
||||
(document) @local.scope
|
||||
(node (node_children) @local.scope)
|
||||
(node_children (node) @local.scope)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
(node_field) @definition.field
|
||||
(node_field) @local.definition.field
|
||||
|
||||
(node (identifier) @definition.type)
|
||||
(type) @definition.type
|
||||
(node (identifier) @local.definition.type)
|
||||
(type) @local.definition.type
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
;;; Imports
|
||||
|
||||
(package_header
|
||||
. (identifier) @definition.namespace)
|
||||
. (identifier) @local.definition.namespace)
|
||||
|
||||
(import_header
|
||||
(identifier
|
||||
(simple_identifier) @definition.import .)
|
||||
(simple_identifier) @local.definition.import .)
|
||||
(import_alias
|
||||
(type_identifier) @definition.import)?)
|
||||
(type_identifier) @local.definition.import)?)
|
||||
|
||||
;;; Functions
|
||||
|
||||
(function_declaration
|
||||
. (simple_identifier) @definition.function
|
||||
. (simple_identifier) @local.definition.function
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(class_body
|
||||
(function_declaration
|
||||
. (simple_identifier) @definition.method)
|
||||
. (simple_identifier) @local.definition.method)
|
||||
(#set! "definition.method.scope" "parent"))
|
||||
|
||||
;;; Variables
|
||||
|
@ -25,38 +25,38 @@
|
|||
(function_declaration
|
||||
(function_value_parameters
|
||||
(parameter
|
||||
(simple_identifier) @definition.parameter)))
|
||||
(simple_identifier) @local.definition.parameter)))
|
||||
|
||||
(lambda_literal
|
||||
(lambda_parameters
|
||||
(variable_declaration
|
||||
(simple_identifier) @definition.parameter)))
|
||||
(simple_identifier) @local.definition.parameter)))
|
||||
|
||||
(class_body
|
||||
(property_declaration
|
||||
(variable_declaration
|
||||
(simple_identifier) @definition.field)))
|
||||
(simple_identifier) @local.definition.field)))
|
||||
|
||||
(class_declaration
|
||||
(primary_constructor
|
||||
(class_parameter
|
||||
(simple_identifier) @definition.field)))
|
||||
(simple_identifier) @local.definition.field)))
|
||||
|
||||
(enum_class_body
|
||||
(enum_entry
|
||||
(simple_identifier) @definition.field))
|
||||
(simple_identifier) @local.definition.field))
|
||||
|
||||
(variable_declaration
|
||||
(simple_identifier) @definition.var)
|
||||
(simple_identifier) @local.definition.var)
|
||||
|
||||
;;; Types
|
||||
|
||||
(class_declaration
|
||||
(type_identifier) @definition.type
|
||||
(type_identifier) @local.definition.type
|
||||
(#set! "definition.type.scope" "parent"))
|
||||
|
||||
(type_alias
|
||||
(type_identifier) @definition.type
|
||||
(type_identifier) @local.definition.type
|
||||
(#set! "definition.type.scope" "parent"))
|
||||
|
||||
;;; Scopes
|
||||
|
@ -81,4 +81,4 @@
|
|||
(enum_entry)
|
||||
|
||||
(interpolated_expression)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(nonterminal_name
|
||||
(macro_id) @definition.function)
|
||||
(macro_id) @local.definition.function)
|
||||
|
||||
(nonterminal_name
|
||||
(identifier) @definition.function)
|
||||
(identifier) @local.definition.function)
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
(symbol)
|
||||
(filename)
|
||||
(quoted_symbol)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(output_section name: (symbol) @definition.var)
|
||||
(output_section name: (symbol) @local.definition.var)
|
||||
|
||||
(memory_command name: (symbol) @definition.var)
|
||||
(memory_command name: (symbol) @local.definition.var)
|
||||
|
||||
(phdrs_command name: (symbol) @definition.var)
|
||||
(phdrs_command name: (symbol) @local.definition.var)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
[(anonymous_function) (binding) (def) (let)] @scope
|
||||
[(anonymous_function) (binding) (def) (let)] @local.scope
|
||||
|
||||
(anonymous_argument (var) @definition.parameter)
|
||||
(labeled_argument label: (var) @definition.parameter)
|
||||
(anonymous_argument (var) @local.definition.parameter)
|
||||
(labeled_argument label: (var) @local.definition.parameter)
|
||||
|
||||
(binding
|
||||
defined: (var) @definition.var)
|
||||
(def defined: (var) @definition.var)
|
||||
(let defined: (var) @definition.var)
|
||||
(meth_pattern (var) @definition.var)
|
||||
(list_pattern (var) @definition.var)
|
||||
(tuple_pattern (var) @definition.var)
|
||||
(spread (var) @definition.var)
|
||||
defined: (var) @local.definition.var)
|
||||
(def defined: (var) @local.definition.var)
|
||||
(let defined: (var) @local.definition.var)
|
||||
(meth_pattern (var) @local.definition.var)
|
||||
(list_pattern (var) @local.definition.var)
|
||||
(tuple_pattern (var) @local.definition.var)
|
||||
(spread (var) @local.definition.var)
|
||||
|
||||
(var) @reference
|
||||
(var) @local.reference
|
||||
|
|
|
@ -9,43 +9,43 @@
|
|||
(for_statement)
|
||||
(function_declaration)
|
||||
(function_definition)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; Definitions
|
||||
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
(dot_index_expression . (_) @definition.associated (identifier) @definition.var)))
|
||||
(dot_index_expression . (_) @local.definition.associated (identifier) @local.definition.var)))
|
||||
|
||||
((function_declaration
|
||||
name: (identifier) @definition.function)
|
||||
name: (identifier) @local.definition.function)
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name: (dot_index_expression
|
||||
. (_) @definition.associated (identifier) @definition.function))
|
||||
. (_) @local.definition.associated (identifier) @local.definition.function))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name: (method_index_expression
|
||||
. (_) @definition.associated (identifier) @definition.method))
|
||||
. (_) @local.definition.associated (identifier) @local.definition.method))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
(for_generic_clause
|
||||
(variable_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_numeric_clause
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(parameters (identifier) @definition.parameter)
|
||||
(parameters (identifier) @local.definition.parameter)
|
||||
|
||||
; References
|
||||
|
||||
[
|
||||
(identifier)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
|
|
@ -9,43 +9,43 @@
|
|||
(for_statement)
|
||||
(function_declaration)
|
||||
(function_definition)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
[
|
||||
(identifier)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
(dot_index_expression . (_) @definition.associated (identifier) @definition.var)))
|
||||
(dot_index_expression . (_) @local.definition.associated (identifier) @local.definition.var)))
|
||||
|
||||
((function_declaration
|
||||
name: (identifier) @definition.function)
|
||||
name: (identifier) @local.definition.function)
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name: (dot_index_expression
|
||||
. (_) @definition.associated (identifier) @definition.function))
|
||||
. (_) @local.definition.associated (identifier) @local.definition.function))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
((function_declaration
|
||||
name: (method_index_expression
|
||||
. (_) @definition.associated (identifier) @definition.method))
|
||||
. (_) @local.definition.associated (identifier) @local.definition.method))
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
(for_generic_clause
|
||||
(variable_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(for_numeric_clause
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(parameter (identifier) @definition.parameter)
|
||||
(parameter (identifier) @local.definition.parameter)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
(macro_definition
|
||||
name: (symbol) @definition.macro)
|
||||
name: (symbol) @local.definition.macro)
|
||||
|
||||
(symbol_assignment
|
||||
name: (symbol) @definition.var)
|
||||
name: (symbol) @local.definition.var)
|
||||
|
||||
(label
|
||||
name: (symbol) @definition.constant)
|
||||
name: (symbol) @local.definition.constant)
|
||||
(symbol_definition
|
||||
name: (symbol) @definition.constant)
|
||||
name: (symbol) @local.definition.constant)
|
||||
(offset_definition
|
||||
name: (symbol) @definition.constant)
|
||||
name: (symbol) @local.definition.constant)
|
||||
(register_definition
|
||||
name: (symbol) @definition.constant)
|
||||
name: (symbol) @local.definition.constant)
|
||||
(register_list_definition
|
||||
name: (symbol) @definition.constant)
|
||||
name: (symbol) @local.definition.constant)
|
||||
|
||||
(external_reference
|
||||
symbols: (symbol_list
|
||||
(symbol) @definition.import))
|
||||
(symbol) @local.definition.import))
|
||||
|
||||
(symbol) @reference
|
||||
(symbol) @local.reference
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @definition.function
|
||||
name: (identifier) @local.definition.function
|
||||
(function_arguments
|
||||
(identifier)* @definition.parameter
|
||||
("," (identifier) @definition.parameter)*)?) @scope
|
||||
(identifier)* @local.definition.parameter
|
||||
("," (identifier) @local.definition.parameter)*)?) @local.scope
|
||||
|
||||
(assignment left: (identifier) @definition.var)
|
||||
(multioutput_variable (identifier) @definition.var)
|
||||
(assignment left: (identifier) @local.definition.var)
|
||||
(multioutput_variable (identifier) @local.definition.var)
|
||||
|
||||
(iterator . (identifier) @definition.var)
|
||||
(lambda (arguments (identifier) @definition.parameter))
|
||||
(global_operator (identifier) @definition.var)
|
||||
(persistent_operator (identifier) @definition.var)
|
||||
(catch_clause (identifier) @definition)
|
||||
(iterator . (identifier) @local.definition.var)
|
||||
(lambda (arguments (identifier) @local.definition.parameter))
|
||||
(global_operator (identifier) @local.definition.var)
|
||||
(persistent_operator (identifier) @local.definition.var)
|
||||
(catch_clause (identifier) @local.definition)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(region) @scope
|
||||
(region) @local.scope
|
||||
|
||||
(func_arg_list (value_use) @definition.var)
|
||||
(block_arg_list (value_use) @definition.var)
|
||||
(op_result (value_use) @definition.var)
|
||||
(func_arg_list (value_use) @local.definition.var)
|
||||
(block_arg_list (value_use) @local.definition.var)
|
||||
(op_result (value_use) @local.definition.var)
|
||||
|
||||
(value_use) @reference
|
||||
(value_use) @local.reference
|
||||
|
|
|
@ -1,112 +1,112 @@
|
|||
|
||||
; ==============================================================================
|
||||
; @definition ; various definitions
|
||||
; @local.definition ; various definitions
|
||||
|
||||
(block
|
||||
label: [
|
||||
(identifier) @definition
|
||||
(accent_quoted) @definition
|
||||
(identifier) @local.definition
|
||||
(accent_quoted) @local.definition
|
||||
])
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.constant ; constants
|
||||
; @local.definition.constant ; constants
|
||||
|
||||
(const_section
|
||||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.constant
|
||||
(accent_quoted) @definition.constant
|
||||
(exported_symbol (identifier) @definition.constant)
|
||||
(exported_symbol (accent_quoted) @definition.constant)
|
||||
(identifier) @local.definition.constant
|
||||
(accent_quoted) @local.definition.constant
|
||||
(exported_symbol (identifier) @local.definition.constant)
|
||||
(exported_symbol (accent_quoted) @local.definition.constant)
|
||||
]))
|
||||
type: (type_expression)? @definition.associated))
|
||||
type: (type_expression)? @local.definition.associated))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.function ; functions
|
||||
; @local.definition.function ; functions
|
||||
|
||||
(proc_declaration
|
||||
name: [
|
||||
(identifier) @definition.function
|
||||
(accent_quoted) @definition.function
|
||||
(exported_symbol (identifier) @definition.function)
|
||||
(exported_symbol (accent_quoted) @definition.function)
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol (identifier) @local.definition.function)
|
||||
(exported_symbol (accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(func_declaration
|
||||
name: [
|
||||
(identifier) @definition.function
|
||||
(accent_quoted) @definition.function
|
||||
(exported_symbol (identifier) @definition.function)
|
||||
(exported_symbol (accent_quoted) @definition.function)
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol (identifier) @local.definition.function)
|
||||
(exported_symbol (accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(iterator_declaration
|
||||
name: [
|
||||
(identifier) @definition.function
|
||||
(accent_quoted) @definition.function
|
||||
(exported_symbol (identifier) @definition.function)
|
||||
(exported_symbol (accent_quoted) @definition.function)
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol (identifier) @local.definition.function)
|
||||
(exported_symbol (accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
(converter_declaration
|
||||
name: [
|
||||
(identifier) @definition.function
|
||||
(accent_quoted) @definition.function
|
||||
(exported_symbol (identifier) @definition.function)
|
||||
(exported_symbol (accent_quoted) @definition.function)
|
||||
(identifier) @local.definition.function
|
||||
(accent_quoted) @local.definition.function
|
||||
(exported_symbol (identifier) @local.definition.function)
|
||||
(exported_symbol (accent_quoted) @local.definition.function)
|
||||
]
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.method ; methods
|
||||
; @local.definition.method ; methods
|
||||
|
||||
(method_declaration
|
||||
name: [
|
||||
(identifier) @definition.method
|
||||
(accent_quoted) @definition.method
|
||||
(exported_symbol (identifier) @definition.method)
|
||||
(exported_symbol (accent_quoted) @definition.method)
|
||||
(identifier) @local.definition.method
|
||||
(accent_quoted) @local.definition.method
|
||||
(exported_symbol (identifier) @local.definition.method)
|
||||
(exported_symbol (accent_quoted) @local.definition.method)
|
||||
]
|
||||
(#set! "definition.method.scope" "parent"))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.var ; variables
|
||||
; @local.definition.var ; variables
|
||||
|
||||
(var_section
|
||||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.var
|
||||
(accent_quoted) @definition.var
|
||||
(exported_symbol (identifier) @definition.var)
|
||||
(exported_symbol (accent_quoted) @definition.var)
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
(exported_symbol (identifier) @local.definition.var)
|
||||
(exported_symbol (accent_quoted) @local.definition.var)
|
||||
]))
|
||||
type: (type_expression)? @definition.associated))
|
||||
type: (type_expression)? @local.definition.associated))
|
||||
|
||||
(let_section
|
||||
(variable_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.var
|
||||
(accent_quoted) @definition.var
|
||||
(exported_symbol (identifier) @definition.var)
|
||||
(exported_symbol (accent_quoted) @definition.var)
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
(exported_symbol (identifier) @local.definition.var)
|
||||
(exported_symbol (accent_quoted) @local.definition.var)
|
||||
]))
|
||||
type: (type_expression)? @definition.associated))
|
||||
type: (type_expression)? @local.definition.associated))
|
||||
|
||||
(for
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.var
|
||||
(accent_quoted) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
])))
|
||||
|
||||
(try
|
||||
|
@ -114,84 +114,84 @@
|
|||
values: (expression_list
|
||||
(infix_expression
|
||||
right: [
|
||||
(identifier) @definition.var
|
||||
(accent_quoted) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(accent_quoted) @local.definition.var
|
||||
]))))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.parameter ; parameters
|
||||
; @local.definition.parameter ; parameters
|
||||
|
||||
(parameter_declaration
|
||||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted) @definition.parameter
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted) @local.definition.parameter
|
||||
]))
|
||||
type: (type_expression)? @definition.associated)
|
||||
type: (type_expression)? @local.definition.associated)
|
||||
|
||||
(concept_declaration
|
||||
parameters:
|
||||
(parameter_list [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted (identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted (identifier) @local.definition.parameter)
|
||||
]))
|
||||
(var_parameter [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted (identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted (identifier) @local.definition.parameter)
|
||||
])
|
||||
(type_parameter [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted (identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted (identifier) @local.definition.parameter)
|
||||
])
|
||||
(static_parameter [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted (identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted (identifier) @local.definition.parameter)
|
||||
])
|
||||
(ref_parameter [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted (identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted (identifier) @local.definition.parameter)
|
||||
])
|
||||
(pointer_parameter [
|
||||
(identifier) @definition.parameter
|
||||
(accent_quoted (identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter
|
||||
(accent_quoted (identifier) @local.definition.parameter)
|
||||
])
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.macro ; preprocessor macros
|
||||
; @local.definition.macro ; preprocessor macros
|
||||
|
||||
(template_declaration
|
||||
name: [
|
||||
(identifier) @definition.macro
|
||||
(accent_quoted) @definition.macro
|
||||
(exported_symbol (identifier) @definition.macro)
|
||||
(exported_symbol (accent_quoted) @definition.macro)
|
||||
(identifier) @local.definition.macro
|
||||
(accent_quoted) @local.definition.macro
|
||||
(exported_symbol (identifier) @local.definition.macro)
|
||||
(exported_symbol (accent_quoted) @local.definition.macro)
|
||||
]
|
||||
(#set! "definition.macro.scope" "parent"))
|
||||
|
||||
(macro_declaration
|
||||
name: [
|
||||
(identifier) @definition.macro
|
||||
(accent_quoted) @definition.macro
|
||||
(exported_symbol (identifier) @definition.macro)
|
||||
(exported_symbol (accent_quoted) @definition.macro)
|
||||
(identifier) @local.definition.macro
|
||||
(accent_quoted) @local.definition.macro
|
||||
(exported_symbol (identifier) @local.definition.macro)
|
||||
(exported_symbol (accent_quoted) @local.definition.macro)
|
||||
]
|
||||
(#set! "definition.macro.scope" "parent"))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.type ; types or classes
|
||||
; @local.definition.type ; types or classes
|
||||
|
||||
(type_declaration
|
||||
(type_symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.type
|
||||
(accent_quoted) @definition.type
|
||||
(exported_symbol (identifier) @definition.type)
|
||||
(exported_symbol (accent_quoted) @definition.type)
|
||||
(identifier) @local.definition.type
|
||||
(accent_quoted) @local.definition.type
|
||||
(exported_symbol (identifier) @local.definition.type)
|
||||
(exported_symbol (accent_quoted) @local.definition.type)
|
||||
]))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.field ; fields or properties
|
||||
; @local.definition.field ; fields or properties
|
||||
|
||||
; object_declaration
|
||||
; variant_declaration
|
||||
|
@ -202,78 +202,78 @@
|
|||
(symbol_declaration_list
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.field
|
||||
(accent_quoted) @definition.field
|
||||
(exported_symbol (identifier) @definition.field)
|
||||
(exported_symbol (accent_quoted) @definition.field)
|
||||
(identifier) @local.definition.field
|
||||
(accent_quoted) @local.definition.field
|
||||
(exported_symbol (identifier) @local.definition.field)
|
||||
(exported_symbol (accent_quoted) @local.definition.field)
|
||||
]))
|
||||
type: (type_expression)? @definition.associated)
|
||||
type: (type_expression)? @local.definition.associated)
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.enum ; enumerations
|
||||
; @local.definition.enum ; enumerations
|
||||
|
||||
(enum_declaration
|
||||
(enum_field_declaration
|
||||
(symbol_declaration
|
||||
name: [
|
||||
(identifier) @definition.enum
|
||||
(accent_quoted) @definition.enum
|
||||
(identifier) @local.definition.enum
|
||||
(accent_quoted) @local.definition.enum
|
||||
])))
|
||||
|
||||
; ==============================================================================
|
||||
; @definition.namespace ; modules or namespaces
|
||||
; @definition.import ; imported names
|
||||
; @local.definition.namespace ; modules or namespaces
|
||||
; @local.definition.import ; imported names
|
||||
|
||||
(import_statement
|
||||
(expression_list
|
||||
(identifier) @definition.namespace))
|
||||
(identifier) @local.definition.namespace))
|
||||
|
||||
(import_statement
|
||||
(expression_list
|
||||
(infix_expression
|
||||
operator: "as"
|
||||
right: (identifier) @definition.namespace)))
|
||||
right: (identifier) @local.definition.namespace)))
|
||||
|
||||
(import_statement
|
||||
(expression_list
|
||||
(infix_expression
|
||||
operator: (operator) @_operator
|
||||
right: [
|
||||
(identifier) @definition.namespace
|
||||
(array_construction (identifier) @definition.namespace)
|
||||
(identifier) @local.definition.namespace
|
||||
(array_construction (identifier) @local.definition.namespace)
|
||||
]))
|
||||
(#eq? @_operator "/"))
|
||||
|
||||
(import_from_statement
|
||||
module: (infix_expression
|
||||
operator: (operator) @_operator
|
||||
right: (identifier) @definition.namespace)
|
||||
right: (identifier) @local.definition.namespace)
|
||||
(expression_list [
|
||||
(identifier) @definition.import
|
||||
(accent_quoted) @definition.import
|
||||
(identifier) @local.definition.import
|
||||
(accent_quoted) @local.definition.import
|
||||
])
|
||||
(#eq? @_operator "/"))
|
||||
|
||||
; ==============================================================================
|
||||
; @scope ; scope block
|
||||
; @local.scope ; scope block
|
||||
|
||||
; (when)
|
||||
; NOTE: `when` does actually not create a scope
|
||||
|
||||
(if
|
||||
consequence: (statement_list) @scope
|
||||
alternative: (elif_branch)* @scope
|
||||
alternative: (else_branch)? @scope)
|
||||
consequence: (statement_list) @local.scope
|
||||
alternative: (elif_branch)* @local.scope
|
||||
alternative: (else_branch)? @local.scope)
|
||||
|
||||
(case
|
||||
alternative: (of_branch)* @scope
|
||||
alternative: (elif_branch)* @scope
|
||||
alternative: (else_branch)? @scope)
|
||||
alternative: (of_branch)* @local.scope
|
||||
alternative: (elif_branch)* @local.scope
|
||||
alternative: (else_branch)? @local.scope)
|
||||
|
||||
(try
|
||||
body: (statement_list) @scope
|
||||
(except_branch) @scope
|
||||
(finally_branch)? @scope)
|
||||
body: (statement_list) @local.scope
|
||||
(except_branch) @local.scope
|
||||
(finally_branch)? @local.scope)
|
||||
|
||||
[
|
||||
(for)
|
||||
|
@ -294,10 +294,10 @@
|
|||
(iterator_expression)
|
||||
|
||||
(concept_declaration)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; ==============================================================================
|
||||
; @reference ; identifier reference
|
||||
; @local.reference ; identifier reference
|
||||
|
||||
(identifier) @reference
|
||||
(accent_quoted) @reference
|
||||
(identifier) @local.reference
|
||||
(accent_quoted) @local.reference
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
; let bindings
|
||||
(let_expression (binding_set (binding . (attrpath) @definition.var))) @scope
|
||||
(let_expression (binding_set (binding . (attrpath) @local.definition.var))) @local.scope
|
||||
|
||||
; rec attrsets
|
||||
(rec_attrset_expression (binding_set (binding . (attrpath) @definition.field))) @scope
|
||||
(rec_attrset_expression (binding_set (binding . (attrpath) @local.definition.field))) @local.scope
|
||||
|
||||
; functions and parameters
|
||||
(function_expression . [
|
||||
(identifier) @definition.parameter
|
||||
(formals (formal . (identifier) @definition.parameter))
|
||||
]) @scope
|
||||
((formals) "@" (identifier) @definition.parameter) ; I couldn't get this to work properly inside the (function)
|
||||
(identifier) @local.definition.parameter
|
||||
(formals (formal . (identifier) @local.definition.parameter))
|
||||
]) @local.scope
|
||||
((formals) "@" (identifier) @local.definition.parameter) ; I couldn't get this to work properly inside the (function)
|
||||
|
||||
(variable_expression (identifier) @reference)
|
||||
(inherited_attrs attr: (identifier) @reference)
|
||||
(variable_expression (identifier) @local.reference)
|
||||
(inherited_attrs attr: (identifier) @local.reference)
|
||||
|
|
|
@ -18,60 +18,60 @@
|
|||
(let_class_expression)
|
||||
(object_expression)
|
||||
(attribute_payload)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; Definitions
|
||||
;------------
|
||||
|
||||
(value_pattern) @definition.var
|
||||
(value_pattern) @local.definition.var
|
||||
|
||||
(let_binding
|
||||
pattern: (value_name) @definition.var
|
||||
pattern: (value_name) @local.definition.var
|
||||
(#set! definition.var.scope "parent"))
|
||||
|
||||
(let_binding
|
||||
pattern: (tuple_pattern (value_name) @definition.var)
|
||||
pattern: (tuple_pattern (value_name) @local.definition.var)
|
||||
(#set! definition.var.scope "parent"))
|
||||
|
||||
(let_binding
|
||||
pattern: (record_pattern (field_pattern (value_name) @definition.var))
|
||||
pattern: (record_pattern (field_pattern (value_name) @local.definition.var))
|
||||
(#set! definition.var.scope "parent"))
|
||||
|
||||
(external (value_name) @definition.var)
|
||||
(external (value_name) @local.definition.var)
|
||||
|
||||
(type_binding (type_constructor) @definition.type)
|
||||
(type_binding (type_constructor) @local.definition.type)
|
||||
|
||||
(abstract_type (type_constructor) @definition.type)
|
||||
(abstract_type (type_constructor) @local.definition.type)
|
||||
|
||||
(method_definition (method_name) @definition.method)
|
||||
(method_definition (method_name) @local.definition.method)
|
||||
|
||||
(module_binding
|
||||
(module_name) @definition.namespace
|
||||
(module_name) @local.definition.namespace
|
||||
(#set! definition.namespace.scope "parent"))
|
||||
|
||||
(module_parameter (module_name) @definition.namespace)
|
||||
(module_parameter (module_name) @local.definition.namespace)
|
||||
|
||||
(module_type_definition (module_type_name) @definition.type)
|
||||
(module_type_definition (module_type_name) @local.definition.type)
|
||||
|
||||
; References
|
||||
;------------
|
||||
|
||||
(value_path .
|
||||
(value_name) @reference
|
||||
(value_name) @local.reference
|
||||
(#set! reference.kind "var"))
|
||||
|
||||
(type_constructor_path .
|
||||
(type_constructor) @reference
|
||||
(type_constructor) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(method_invocation
|
||||
(method_name) @reference
|
||||
(method_name) @local.reference
|
||||
(#set! reference.kind "method"))
|
||||
|
||||
(module_path .
|
||||
(module_name) @reference
|
||||
(module_name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(module_type_path .
|
||||
(module_type_name) @reference
|
||||
(module_type_name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
|
|
@ -4,36 +4,36 @@
|
|||
(block)
|
||||
(declaration)
|
||||
(statement)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(package_declaration (identifier) @definition.namespace)
|
||||
(package_declaration (identifier) @local.definition.namespace)
|
||||
|
||||
(import_declaration alias: (identifier) @definition.namespace)
|
||||
(import_declaration alias: (identifier) @local.definition.namespace)
|
||||
|
||||
(procedure_declaration (identifier) @definition.function)
|
||||
(procedure_declaration (identifier) @local.definition.function)
|
||||
|
||||
(struct_declaration (identifier) @definition.type "::")
|
||||
(struct_declaration (identifier) @local.definition.type "::")
|
||||
|
||||
(enum_declaration (identifier) @definition.enum "::")
|
||||
(enum_declaration (identifier) @local.definition.enum "::")
|
||||
|
||||
(union_declaration (identifier) @definition.type "::")
|
||||
(union_declaration (identifier) @local.definition.type "::")
|
||||
|
||||
(variable_declaration (identifier) @definition.var ":=")
|
||||
(variable_declaration (identifier) @local.definition.var ":=")
|
||||
|
||||
(const_declaration (identifier) @definition.constant "::")
|
||||
(const_declaration (identifier) @local.definition.constant "::")
|
||||
|
||||
(const_type_declaration (identifier) @definition.type ":")
|
||||
(const_type_declaration (identifier) @local.definition.type ":")
|
||||
|
||||
(parameter (identifier) @definition.parameter ":"?)
|
||||
(parameter (identifier) @local.definition.parameter ":"?)
|
||||
|
||||
(default_parameter (identifier) @definition.parameter ":=")
|
||||
(default_parameter (identifier) @local.definition.parameter ":=")
|
||||
|
||||
(field (identifier) @definition.field ":")
|
||||
(field (identifier) @local.definition.field ":")
|
||||
|
||||
(label_statement (identifier) @definition ":")
|
||||
(label_statement (identifier) @local.definition ":")
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
|
||||
(root) @scope
|
||||
(root) @local.scope
|
||||
|
||||
(defProc) @scope
|
||||
(lambda) @scope
|
||||
(interface (declProc) @scope)
|
||||
(declSection (declProc) @scope)
|
||||
(declClass (declProc) @scope)
|
||||
(declHelper (declProc) @scope)
|
||||
(declProcRef) @scope
|
||||
(defProc) @local.scope
|
||||
(lambda) @local.scope
|
||||
(interface (declProc) @local.scope)
|
||||
(declSection (declProc) @local.scope)
|
||||
(declClass (declProc) @local.scope)
|
||||
(declHelper (declProc) @local.scope)
|
||||
(declProcRef) @local.scope
|
||||
|
||||
(exceptionHandler) @scope
|
||||
(exceptionHandler variable: (identifier) @definition)
|
||||
(exceptionHandler) @local.scope
|
||||
(exceptionHandler variable: (identifier) @local.definition)
|
||||
|
||||
(declArg name: (identifier) @definition)
|
||||
(declVar name: (identifier) @definition)
|
||||
(declConst name: (identifier) @definition)
|
||||
(declLabel name: (identifier) @definition)
|
||||
(genericArg name: (identifier) @definition)
|
||||
(declEnumValue name: (identifier) @definition)
|
||||
(declType name: (identifier) @definition)
|
||||
(declType name: (genericTpl entity: (identifier) @definition))
|
||||
(declArg name: (identifier) @local.definition)
|
||||
(declVar name: (identifier) @local.definition)
|
||||
(declConst name: (identifier) @local.definition)
|
||||
(declLabel name: (identifier) @local.definition)
|
||||
(genericArg name: (identifier) @local.definition)
|
||||
(declEnumValue name: (identifier) @local.definition)
|
||||
(declType name: (identifier) @local.definition)
|
||||
(declType name: (genericTpl entity: (identifier) @local.definition))
|
||||
|
||||
(declProc name: (identifier) @definition)
|
||||
(identifier) @reference
|
||||
(declProc name: (identifier) @local.definition)
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -2,86 +2,86 @@
|
|||
;-------
|
||||
|
||||
((class_declaration
|
||||
name: (name) @definition.type) @scope
|
||||
name: (name) @local.definition.type) @local.scope
|
||||
(#set! definition.type.scope "parent"))
|
||||
|
||||
((method_declaration
|
||||
name: (name) @definition.method) @scope
|
||||
name: (name) @local.definition.method) @local.scope
|
||||
(#set! definition.method.scope "parent"))
|
||||
|
||||
((function_definition
|
||||
name: (name) @definition.function) @scope
|
||||
name: (name) @local.definition.function) @local.scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(anonymous_function_creation_expression
|
||||
(anonymous_function_use_clause
|
||||
(variable_name
|
||||
(name) @definition.var))) @scope
|
||||
(name) @local.definition.var))) @local.scope
|
||||
|
||||
; Definitions
|
||||
;------------
|
||||
|
||||
(simple_parameter
|
||||
(variable_name
|
||||
(name) @definition.var))
|
||||
(name) @local.definition.var))
|
||||
|
||||
(foreach_statement
|
||||
(pair
|
||||
(variable_name
|
||||
(name) @definition.var)))
|
||||
(name) @local.definition.var)))
|
||||
|
||||
(foreach_statement
|
||||
(variable_name
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "var"))
|
||||
(variable_name
|
||||
(name) @definition.var))
|
||||
(name) @local.definition.var))
|
||||
|
||||
(property_declaration
|
||||
(property_element
|
||||
(variable_name
|
||||
(name) @definition.field)))
|
||||
(name) @local.definition.field)))
|
||||
|
||||
(namespace_use_clause
|
||||
(qualified_name
|
||||
(name) @definition.type))
|
||||
(name) @local.definition.type))
|
||||
|
||||
; References
|
||||
;------------
|
||||
|
||||
(named_type
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(named_type
|
||||
(qualified_name) @reference
|
||||
(qualified_name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(variable_name
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "var"))
|
||||
|
||||
(member_access_expression
|
||||
name: (name) @reference
|
||||
name: (name) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
(member_call_expression
|
||||
name: (name) @reference
|
||||
name: (name) @local.reference
|
||||
(#set! reference.kind "method"))
|
||||
|
||||
(function_call_expression
|
||||
function: (qualified_name
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "function")))
|
||||
|
||||
(object_creation_expression
|
||||
(qualified_name
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "type")))
|
||||
|
||||
(scoped_call_expression
|
||||
scope: (qualified_name
|
||||
(name) @reference
|
||||
(name) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
name: (name) @reference
|
||||
name: (name) @local.reference
|
||||
(#set! reference.kind "method"))
|
||||
|
|
|
@ -31,61 +31,61 @@
|
|||
|
||||
(array_literal)
|
||||
(object_literal)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(field
|
||||
name: (identifier) @definition.field)
|
||||
name: (identifier) @local.definition.field)
|
||||
|
||||
(use_statement
|
||||
(identifier) @definition.import)
|
||||
(identifier) @local.definition.import)
|
||||
|
||||
(constructor
|
||||
(identifier) @definition.method)
|
||||
(identifier) @local.definition.method)
|
||||
|
||||
(method
|
||||
(identifier) @definition.method)
|
||||
(identifier) @local.definition.method)
|
||||
|
||||
(behavior
|
||||
(identifier) @definition.method)
|
||||
(identifier) @local.definition.method)
|
||||
|
||||
(actor_definition
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(type_alias
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(class_definition
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(primitive_definition
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(interface_definition
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(trait_definition
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(struct_definition
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(for_statement
|
||||
[
|
||||
(identifier) @definition.var
|
||||
(tuple_expression (identifier) @definition.var)
|
||||
(identifier) @local.definition.var
|
||||
(tuple_expression (identifier) @local.definition.var)
|
||||
])
|
||||
|
||||
(with_elem
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
(property (key) @definition)
|
||||
(property (key) @local.definition)
|
||||
|
||||
(substitution (key) @reference)
|
||||
(substitution (key) @local.reference)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
(case_statement)
|
||||
(hash)
|
||||
(array)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
|
@ -21,26 +21,26 @@
|
|||
(identifier)
|
||||
(class_identifier)
|
||||
(variable)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(attribute [(identifier) (variable)] @definition.field)
|
||||
(attribute [(identifier) (variable)] @local.definition.field)
|
||||
|
||||
(function_declaration
|
||||
[(identifier) (class_identifier)] @definition.function)
|
||||
[(identifier) (class_identifier)] @local.definition.function)
|
||||
|
||||
(include_statement [(identifier) (class_identifier)] @definition.import)
|
||||
(include_statement [(identifier) (class_identifier)] @local.definition.import)
|
||||
|
||||
(parameter (variable) @definition.parameter)
|
||||
(parameter (variable) @local.definition.parameter)
|
||||
|
||||
(class_definition
|
||||
[(identifier) (class_identifier)] @definition.type)
|
||||
[(identifier) (class_identifier)] @local.definition.type)
|
||||
|
||||
(node_definition
|
||||
(node_name (identifier) @definition.type))
|
||||
(node_name (identifier) @local.definition.type))
|
||||
|
||||
(resource_declaration
|
||||
[(identifier) (class_identifier)] @definition.type)
|
||||
[(identifier) (class_identifier)] @local.definition.type)
|
||||
|
||||
(assignment . (variable) @definition.var)
|
||||
(assignment . (variable) @local.definition.var)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(signature name: (variable)) @definition.type
|
||||
(function name: (variable)) @definition.function
|
||||
(pat_name (variable)) @definition
|
||||
(exp_name (variable)) @reference
|
||||
(signature name: (variable)) @local.definition.type
|
||||
(function name: (variable)) @local.definition.function
|
||||
(pat_name (variable)) @local.definition
|
||||
(exp_name (variable)) @local.reference
|
||||
|
|
|
@ -1,115 +1,115 @@
|
|||
;;; Program structure
|
||||
(module) @scope
|
||||
(module) @local.scope
|
||||
|
||||
(class_definition
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @definition.field)))) @scope
|
||||
left: (identifier) @local.definition.field)))) @local.scope
|
||||
(class_definition
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @definition.field))))) @scope
|
||||
(identifier) @local.definition.field))))) @local.scope
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (identifier) @definition.import)
|
||||
alias: (identifier) @local.definition.import)
|
||||
(import_statement
|
||||
name: (dotted_name ((identifier) @definition.import)))
|
||||
name: (dotted_name ((identifier) @local.definition.import)))
|
||||
(import_from_statement
|
||||
name: (dotted_name ((identifier) @definition.import)))
|
||||
name: (dotted_name ((identifier) @local.definition.import)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(default_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
; *args parameter
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
; **kwargs parameter
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
; Function defines function and scope
|
||||
((function_definition
|
||||
name: (identifier) @definition.function) @scope
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
|
||||
((class_definition
|
||||
name: (identifier) @definition.type) @scope
|
||||
name: (identifier) @local.definition.type) @local.scope
|
||||
(#set! definition.type.scope "parent"))
|
||||
|
||||
(class_definition
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @definition.method)))
|
||||
name: (identifier) @local.definition.method)))
|
||||
|
||||
;;; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left: (pattern_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(for_statement
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(for_statement
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
; not a scope!
|
||||
;(while_statement) @scope
|
||||
;(while_statement) @local.scope
|
||||
|
||||
; for in list comprehension
|
||||
(for_in_clause
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
(for_in_clause
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(for_in_clause
|
||||
left: (pattern_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @scope
|
||||
(list_comprehension) @scope
|
||||
(set_comprehension) @scope
|
||||
(dictionary_comprehension) @local.scope
|
||||
(list_comprehension) @local.scope
|
||||
(set_comprehension) @local.scope
|
||||
|
||||
;;; Assignments
|
||||
|
||||
(assignment
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left: (pattern_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(assignment
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (attribute
|
||||
(identifier)
|
||||
(identifier) @definition.field))
|
||||
(identifier) @local.definition.field))
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(as_pattern
|
||||
alias: (as_pattern_target) @definition.var)
|
||||
alias: (as_pattern_target) @local.definition.var)
|
||||
|
||||
;;; REFERENCES
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
; SCOPES
|
||||
(module) @scope
|
||||
(dataclass) @scope
|
||||
(datatype) @scope
|
||||
(module) @local.scope
|
||||
(dataclass) @local.scope
|
||||
(datatype) @local.scope
|
||||
;; TODO does not work
|
||||
;(classMember (body) @scope)
|
||||
(memberPredicate (body) @scope)
|
||||
(classlessPredicate (body) @scope)
|
||||
(quantified (conjunction) @scope)
|
||||
(select) @scope
|
||||
;(classMember (body) @local.scope)
|
||||
(memberPredicate (body) @local.scope)
|
||||
(classlessPredicate (body) @local.scope)
|
||||
(quantified (conjunction) @local.scope)
|
||||
(select) @local.scope
|
||||
|
||||
; DEFINITIONS
|
||||
|
||||
; module
|
||||
(module name: (moduleName) @definition.namespace)
|
||||
(module name: (moduleName) @local.definition.namespace)
|
||||
|
||||
; classes
|
||||
(dataclass name: (className) @definition.type)
|
||||
(datatype name: (className) @definition.type)
|
||||
(dataclass name: (className) @local.definition.type)
|
||||
(datatype name: (className) @local.definition.type)
|
||||
|
||||
; predicates
|
||||
(charpred (className) @definition.method)
|
||||
(memberPredicate name: (predicateName) @definition.method)
|
||||
(classlessPredicate name: (predicateName) @definition.function)
|
||||
(charpred (className) @local.definition.method)
|
||||
(memberPredicate name: (predicateName) @local.definition.method)
|
||||
(classlessPredicate name: (predicateName) @local.definition.function)
|
||||
|
||||
; variables
|
||||
(varDecl (varName (simpleId) @definition.var))
|
||||
(varDecl (varName (simpleId) @local.definition.var))
|
||||
|
||||
; REFERENCES
|
||||
(simpleId) @reference
|
||||
(simpleId) @local.reference
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
(program) @scope
|
||||
(program (named_node) @scope)
|
||||
(program (anonymous_node) @scope)
|
||||
(program (grouping) @scope)
|
||||
(program) @local.scope
|
||||
(program (named_node) @local.scope)
|
||||
(program (anonymous_node) @local.scope)
|
||||
(program (grouping) @local.scope)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
(named_node
|
||||
(capture) @definition.var)
|
||||
(capture) @local.definition.var)
|
||||
|
||||
(anonymous_node
|
||||
(capture) @definition.var)
|
||||
(capture) @local.definition.var)
|
||||
|
||||
(grouping
|
||||
(capture) @definition.var)
|
||||
(capture) @local.definition.var)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
; locals.scm
|
||||
|
||||
(function_definition) @scope
|
||||
(function_definition) @local.scope
|
||||
|
||||
(formal_parameters (identifier) @definition.parameter)
|
||||
(formal_parameters (identifier) @local.definition.parameter)
|
||||
|
||||
(left_assignment name: (identifier) @definition)
|
||||
(equals_assignment name: (identifier) @definition)
|
||||
(right_assignment name: (identifier) @definition)
|
||||
(left_assignment name: (identifier) @local.definition)
|
||||
(equals_assignment name: (identifier) @local.definition)
|
||||
(right_assignment name: (identifier) @local.definition)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(rule_set (selectors (id_selector))) @scope
|
||||
(rule_set (selectors (id_selector))) @local.scope
|
||||
|
||||
(block (declaration (property_name) @definition.var))
|
||||
(block (declaration (property_name) @local.definition.var))
|
||||
|
||||
(reference_value name:(identifier) @reference)
|
||||
(reference_value name:(identifier) @local.reference)
|
||||
|
|
|
@ -1 +1 @@
|
|||
(body) @scope
|
||||
(body) @local.scope
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(source_file) @scope
|
||||
(source_file (array) @scope)
|
||||
(source_file (map) @scope)
|
||||
(source_file (struct) @scope)
|
||||
(source_file (tuple) @scope)
|
||||
(source_file) @local.scope
|
||||
(source_file (array) @local.scope)
|
||||
(source_file (map) @local.scope)
|
||||
(source_file (struct) @local.scope)
|
||||
(source_file (tuple) @local.scope)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
(struct_entry (identifier) @definition.field)
|
||||
(struct_entry (identifier) @definition.enum (enum_variant))
|
||||
(struct_entry (identifier) @local.definition.field)
|
||||
(struct_entry (identifier) @local.definition.enum (enum_variant))
|
||||
|
||||
(struct (struct_name) @definition.type)
|
||||
(struct (struct_name) @local.definition.type)
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
;; Scopes
|
||||
|
||||
(document) @scope
|
||||
(document) @local.scope
|
||||
|
||||
(directive) @scope
|
||||
(directive) @local.scope
|
||||
|
||||
;; Definitions
|
||||
|
||||
(title) @definition
|
||||
(title) @local.definition
|
||||
|
||||
(substitution_definition
|
||||
name: (substitution) @definition)
|
||||
name: (substitution) @local.definition)
|
||||
|
||||
(footnote
|
||||
name: (label) @definition)
|
||||
name: (label) @local.definition)
|
||||
|
||||
(citation
|
||||
name: (label) @definition)
|
||||
name: (label) @local.definition)
|
||||
|
||||
(target
|
||||
name: (name) @definition)
|
||||
name: (name) @local.definition)
|
||||
|
||||
; Inline targets
|
||||
(inline_target) @definition
|
||||
(inline_target) @local.definition
|
||||
|
||||
; The role directive can define a new role
|
||||
((directive
|
||||
name: (type) @_type
|
||||
body: (body (arguments) @definition))
|
||||
body: (body (arguments) @local.definition))
|
||||
(#eq? @_type "role"))
|
||||
|
||||
;; References
|
||||
|
@ -37,4 +37,4 @@
|
|||
(citation_reference)
|
||||
(reference)
|
||||
(role)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
|
|
@ -21,35 +21,35 @@
|
|||
; SOFTWARE.
|
||||
|
||||
;;; DECLARATIONS AND SCOPES
|
||||
(method) @scope
|
||||
(class) @scope
|
||||
(method) @local.scope
|
||||
(class) @local.scope
|
||||
|
||||
[
|
||||
(block)
|
||||
(do_block)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(constant) @reference
|
||||
(instance_variable) @reference
|
||||
(identifier) @local.reference
|
||||
(constant) @local.reference
|
||||
(instance_variable) @local.reference
|
||||
|
||||
(module name: (constant) @definition.namespace)
|
||||
(class name: (constant) @definition.type)
|
||||
(method name: [(identifier) (constant)] @definition.function)
|
||||
(singleton_method name: [(identifier) (constant)] @definition.function)
|
||||
(module name: (constant) @local.definition.namespace)
|
||||
(class name: (constant) @local.definition.type)
|
||||
(method name: [(identifier) (constant)] @local.definition.function)
|
||||
(singleton_method name: [(identifier) (constant)] @local.definition.function)
|
||||
|
||||
(method_parameters (identifier) @definition.var)
|
||||
(lambda_parameters (identifier) @definition.var)
|
||||
(block_parameters (identifier) @definition.var)
|
||||
(splat_parameter (identifier) @definition.var)
|
||||
(hash_splat_parameter (identifier) @definition.var)
|
||||
(optional_parameter name: (identifier) @definition.var)
|
||||
(destructured_parameter (identifier) @definition.var)
|
||||
(block_parameter name: (identifier) @definition.var)
|
||||
(keyword_parameter name: (identifier) @definition.var)
|
||||
(method_parameters (identifier) @local.definition.var)
|
||||
(lambda_parameters (identifier) @local.definition.var)
|
||||
(block_parameters (identifier) @local.definition.var)
|
||||
(splat_parameter (identifier) @local.definition.var)
|
||||
(hash_splat_parameter (identifier) @local.definition.var)
|
||||
(optional_parameter name: (identifier) @local.definition.var)
|
||||
(destructured_parameter (identifier) @local.definition.var)
|
||||
(block_parameter name: (identifier) @local.definition.var)
|
||||
(keyword_parameter name: (identifier) @local.definition.var)
|
||||
|
||||
(assignment left: (_) @definition.var)
|
||||
(assignment left: (_) @local.definition.var)
|
||||
|
||||
(left_assignment_list (identifier) @definition.var)
|
||||
(rest_assignment (identifier) @definition.var)
|
||||
(destructured_left_assignment (identifier) @definition.var)
|
||||
(left_assignment_list (identifier) @local.definition.var)
|
||||
(rest_assignment (identifier) @local.definition.var)
|
||||
(destructured_left_assignment (identifier) @local.definition.var)
|
||||
|
|
|
@ -1,88 +1,88 @@
|
|||
; Imports
|
||||
(extern_crate_declaration
|
||||
name: (identifier) @definition.import)
|
||||
name: (identifier) @local.definition.import)
|
||||
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @definition.import))
|
||||
name: (identifier) @local.definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @definition.import)
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
||||
(use_list
|
||||
(identifier) @definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
|
||||
; Functions
|
||||
(function_item
|
||||
name: (identifier) @definition.function)
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(function_item
|
||||
name: (identifier) @definition.method
|
||||
name: (identifier) @local.definition.method
|
||||
parameters: (parameters
|
||||
(self_parameter)))
|
||||
|
||||
; Variables
|
||||
(parameter
|
||||
pattern: (identifier) @definition.var)
|
||||
pattern: (identifier) @local.definition.var)
|
||||
|
||||
(let_declaration
|
||||
pattern: (identifier) @definition.var)
|
||||
pattern: (identifier) @local.definition.var)
|
||||
|
||||
(const_item
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(tuple_pattern
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(let_condition
|
||||
pattern: (_
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(tuple_struct_pattern
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(closure_parameters
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(self_parameter
|
||||
(self) @definition.var)
|
||||
(self) @local.definition.var)
|
||||
|
||||
(for_expression
|
||||
pattern: (identifier) @definition.var)
|
||||
pattern: (identifier) @local.definition.var)
|
||||
|
||||
; Types
|
||||
(struct_item
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
|
||||
; Fields
|
||||
(field_declaration
|
||||
name: (field_identifier) @definition.field)
|
||||
name: (field_identifier) @local.definition.field)
|
||||
|
||||
(enum_variant
|
||||
name: (identifier) @definition.field)
|
||||
name: (identifier) @local.definition.field)
|
||||
|
||||
; References
|
||||
(identifier) @reference
|
||||
((type_identifier) @reference
|
||||
(identifier) @local.reference
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
((field_identifier) @reference
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
|
||||
; Macros
|
||||
(macro_definition
|
||||
name: (identifier) @definition.macro)
|
||||
name: (identifier) @local.definition.macro)
|
||||
|
||||
; Module
|
||||
(mod_item
|
||||
name: (identifier) @definition.namespace)
|
||||
name: (identifier) @local.definition.namespace)
|
||||
|
||||
; Scopes
|
||||
[
|
||||
|
@ -99,5 +99,5 @@
|
|||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
|
|
|
@ -6,47 +6,47 @@
|
|||
(function_definition)
|
||||
(block)
|
||||
(for_expression)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @definition.function)
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(function_definition
|
||||
name: ((identifier) @definition.function)
|
||||
name: ((identifier) @local.definition.function)
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(class_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(lambda_expression
|
||||
parameters: (identifier) @definition.var)
|
||||
parameters: (identifier) @local.definition.var)
|
||||
|
||||
(binding
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(val_definition
|
||||
pattern: (identifier) @definition.var)
|
||||
pattern: (identifier) @local.definition.var)
|
||||
|
||||
(var_definition
|
||||
pattern: (identifier) @definition.var)
|
||||
pattern: (identifier) @local.definition.var)
|
||||
|
||||
(val_declaration
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(var_declaration
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(for_expression
|
||||
enumerators: (enumerators
|
||||
(enumerator
|
||||
(tuple_pattern
|
||||
(identifier) @definition.var))))
|
||||
(identifier) @local.definition.var))))
|
||||
|
|
|
@ -7,36 +7,36 @@
|
|||
(packed_switch_directive)
|
||||
(sparse_switch_directive)
|
||||
(subannotation_directive)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(class_identifier)
|
||||
(label)
|
||||
(jmp_label)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
(enum_reference
|
||||
(field_identifier) @definition.enum)
|
||||
(field_identifier) @local.definition.enum)
|
||||
|
||||
((field_definition
|
||||
(access_modifiers) @_mod
|
||||
(field_identifier) @definition.enum)
|
||||
(field_identifier) @local.definition.enum)
|
||||
(#eq? @_mod "enum"))
|
||||
|
||||
(field_definition
|
||||
(field_identifier) @definition.field
|
||||
(field_type) @definition.associated)
|
||||
(field_identifier) @local.definition.field
|
||||
(field_type) @local.definition.associated)
|
||||
|
||||
(annotation_key) @definition.field
|
||||
(annotation_key) @local.definition.field
|
||||
|
||||
(method_definition
|
||||
(method_signature (method_identifier) @definition.method))
|
||||
(method_signature (method_identifier) @local.definition.method))
|
||||
|
||||
(param_identifier) @definition.parameter
|
||||
(param_identifier) @local.definition.parameter
|
||||
|
||||
(annotation_directive
|
||||
(class_identifier) @definition.type)
|
||||
(class_identifier) @local.definition.type)
|
||||
|
||||
(class_directive
|
||||
(class_identifier) @definition.type)
|
||||
(class_identifier) @local.definition.type)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(group_graph_pattern (triples_block) @scope)
|
||||
(group_graph_pattern (triples_block) @local.scope)
|
||||
|
||||
((sub_select (select_clause (var) @definition.var))
|
||||
((sub_select (select_clause (var) @local.definition.var))
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
((select_query (select_clause (var) @definition.var))
|
||||
((select_query (select_clause (var) @local.definition.var))
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(var) @reference
|
||||
(var) @local.reference
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
(foreach_statement)
|
||||
(try_statement)
|
||||
(catch_statement)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
|
||||
; References
|
||||
|
@ -30,38 +30,38 @@
|
|||
[
|
||||
(identifier)
|
||||
(global_variable)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(const_declaration
|
||||
. (identifier) @definition.constant)
|
||||
. (identifier) @local.definition.constant)
|
||||
|
||||
(enum_declaration
|
||||
. (identifier) @definition.enum)
|
||||
. (identifier) @local.definition.enum)
|
||||
|
||||
(member_declaration
|
||||
(identifier) @definition.field
|
||||
(identifier) @local.definition.field
|
||||
. "=")
|
||||
|
||||
(table_slot
|
||||
. (identifier) @definition.field
|
||||
. (identifier) @local.definition.field
|
||||
. ["=" ":"])
|
||||
|
||||
((function_declaration
|
||||
. (identifier) @definition.function)
|
||||
(#not-has-ancestor? @definition.function member_declaration))
|
||||
. (identifier) @local.definition.function)
|
||||
(#not-has-ancestor? @local.definition.function member_declaration))
|
||||
|
||||
(member_declaration
|
||||
(function_declaration
|
||||
. (identifier) @definition.method))
|
||||
. (identifier) @local.definition.method))
|
||||
|
||||
(class_declaration
|
||||
. (identifier) @definition.type)
|
||||
. (identifier) @local.definition.type)
|
||||
|
||||
(var_statement
|
||||
"var" . (identifier) @definition.variable)
|
||||
"var" . (identifier) @local.definition.variable)
|
||||
|
||||
(local_declaration
|
||||
(identifier) @definition.variable
|
||||
(identifier) @local.definition.variable
|
||||
. "=")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(parameter
|
||||
keyword: "Tag"
|
||||
argument: (string) @reference)
|
||||
argument: (string) @local.reference)
|
||||
|
||||
(condition
|
||||
criteria: "tagged"
|
||||
argument: (pattern) @definition)
|
||||
argument: (pattern) @local.definition)
|
||||
|
|
|
@ -1,85 +1,85 @@
|
|||
;;; Program structure
|
||||
(module) @scope
|
||||
(module) @local.scope
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(default_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
; *args parameter
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
; **kwargs parameter
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
; Function defines function and scope
|
||||
((function_definition
|
||||
name: (identifier) @definition.function) @scope
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
;;; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left: (pattern_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(for_statement
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(for_statement
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
; for in list comprehension
|
||||
(for_in_clause
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
(for_in_clause
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(for_in_clause
|
||||
left: (pattern_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @scope
|
||||
(list_comprehension) @scope
|
||||
(set_comprehension) @scope
|
||||
(dictionary_comprehension) @local.scope
|
||||
(list_comprehension) @local.scope
|
||||
(set_comprehension) @local.scope
|
||||
|
||||
;;; Assignments
|
||||
|
||||
(assignment
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left: (pattern_list
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
(assignment
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (attribute
|
||||
(identifier)
|
||||
(identifier) @definition.field))
|
||||
(identifier) @local.definition.field))
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(as_pattern
|
||||
alias: (as_pattern_target) @definition.var)
|
||||
alias: (as_pattern_target) @local.definition.var)
|
||||
|
||||
;;; REFERENCES
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
;; Starlark-specific
|
||||
|
||||
|
@ -87,5 +87,5 @@
|
|||
((call
|
||||
function: (identifier) @_fn
|
||||
arguments: (argument_list
|
||||
(string) @definition.import))
|
||||
(string) @local.definition.import))
|
||||
(#eq? @_fn "load"))
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
(code_block)
|
||||
(function_block)
|
||||
(control_structure)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; Definitions
|
||||
(argument
|
||||
name: (identifier) @definition.parameter
|
||||
name: (identifier) @local.definition.parameter
|
||||
(#set! "definition.var.scope" "local")
|
||||
)
|
||||
|
||||
(variable_definition
|
||||
name: (variable (local_var (identifier) @definition.var
|
||||
name: (variable (local_var (identifier) @local.definition.var
|
||||
)))
|
||||
|
||||
(variable_definition
|
||||
name: (variable (environment_var (identifier) @definition.var))
|
||||
name: (variable (environment_var (identifier) @local.definition.var))
|
||||
(#set! "definition.var.scope" "global"))
|
||||
|
||||
(function_definition name: (variable) @definition.var
|
||||
(function_definition name: (variable) @local.definition.var
|
||||
(#set! "definition.var.scope" "parent")
|
||||
)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(import_declaration (identifier) @definition.import)
|
||||
(function_declaration name: (simple_identifier) @definition.function)
|
||||
(import_declaration (identifier) @local.definition.import)
|
||||
(function_declaration name: (simple_identifier) @local.definition.function)
|
||||
|
||||
; Scopes
|
||||
[
|
||||
|
@ -15,4 +15,4 @@
|
|||
(function_declaration)
|
||||
(class_declaration)
|
||||
(protocol_declaration)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -6,30 +6,30 @@
|
|||
(for_statement)
|
||||
(foreach_statement)
|
||||
(catch_clause)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(init_declarator
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(array_declarator
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @definition.function)
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(tuple_capture
|
||||
(identifier) @definition.var)
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(catch_clause
|
||||
parameter: (identifier) @definition.var)
|
||||
parameter: (identifier) @local.definition.var)
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @reference)
|
||||
function: (identifier) @local.reference)
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
(block) @scope
|
||||
(block) @local.scope
|
||||
|
||||
; Parameter definitions
|
||||
(parameter_declaration
|
||||
command: (identifier)
|
||||
macro: (macro) @definition.parameter)
|
||||
macro: (macro) @local.definition.parameter)
|
||||
|
||||
; Variable definitions
|
||||
(macro_definition
|
||||
command: (identifier)
|
||||
macro: (macro) @definition.var)
|
||||
macro: (macro) @local.definition.var)
|
||||
|
||||
(command_expression
|
||||
command: (identifier)
|
||||
arguments: (argument_list
|
||||
declarator: (trace32_hll_variable) @definition.var))
|
||||
declarator: (trace32_hll_variable) @local.definition.var))
|
||||
|
||||
; Function definitions
|
||||
(subroutine_block
|
||||
command: (identifier)
|
||||
subroutine: (identifier) @definition.function)
|
||||
subroutine: (identifier) @local.definition.function)
|
||||
|
||||
(labeled_expression
|
||||
label: (identifier) @definition.function
|
||||
label: (identifier) @local.definition.function
|
||||
(block))
|
||||
|
||||
; References
|
||||
(
|
||||
(subroutine_call_expression
|
||||
command: (identifier)
|
||||
subroutine: (identifier) @reference)
|
||||
subroutine: (identifier) @local.reference)
|
||||
(#set! reference.kind "function")
|
||||
)
|
||||
|
||||
[
|
||||
(macro)
|
||||
(trace32_hll_variable)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
|
|
@ -10,42 +10,42 @@
|
|||
(foreach)
|
||||
(if)
|
||||
(let)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
[
|
||||
(var)
|
||||
(identifier)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(instruction
|
||||
(identifier) @definition.field)
|
||||
(identifier) @local.definition.field)
|
||||
|
||||
(let_instruction
|
||||
(identifier) @definition.field)
|
||||
(identifier) @local.definition.field)
|
||||
|
||||
(include_directive
|
||||
(string) @definition.import)
|
||||
(string) @local.definition.import)
|
||||
|
||||
(template_arg (identifier) @definition.parameter)
|
||||
(template_arg (identifier) @local.definition.parameter)
|
||||
|
||||
(class
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
(multiclass
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
(def
|
||||
name: (value (_) @definition.type))
|
||||
name: (value (_) @local.definition.type))
|
||||
|
||||
(defm
|
||||
name: (value (_) @definition.type))
|
||||
name: (value (_) @local.definition.type))
|
||||
|
||||
(defset
|
||||
name: (identifier) @definition.type)
|
||||
name: (identifier) @local.definition.type)
|
||||
|
||||
(def_var
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
(var_declaration
|
||||
declarators: (var_declarators
|
||||
(var (identifier)) @definition.var))
|
||||
(var (identifier)) @local.definition.var))
|
||||
|
||||
(var_assignment
|
||||
variables: (assignment_variables
|
||||
(var (identifier) @definition.var) @definition.associated))
|
||||
(var (identifier) @local.definition.var) @local.definition.associated))
|
||||
|
||||
(arg name: (identifier) @definition.parameter)
|
||||
(arg name: (identifier) @local.definition.parameter)
|
||||
|
||||
(anon_function) @scope
|
||||
(anon_function) @local.scope
|
||||
((function_statement
|
||||
(function_name) @definition.function) @scope)
|
||||
(function_name) @local.definition.function) @local.scope)
|
||||
|
||||
(program) @scope
|
||||
(if_statement) @scope
|
||||
(generic_for_statement (for_body) @scope)
|
||||
(numeric_for_statement (for_body) @scope)
|
||||
(repeat_statement) @scope
|
||||
(while_statement (while_body) @scope)
|
||||
(do_statement) @scope
|
||||
(program) @local.scope
|
||||
(if_statement) @local.scope
|
||||
(generic_for_statement (for_body) @local.scope)
|
||||
(numeric_for_statement (for_body) @local.scope)
|
||||
(repeat_statement) @local.scope
|
||||
(while_statement (while_body) @local.scope)
|
||||
(do_statement) @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -3,49 +3,49 @@
|
|||
[
|
||||
(document)
|
||||
(definition)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(annotation_identifier) @definition
|
||||
(annotation_identifier) @local.definition
|
||||
|
||||
(const_definition (identifier) @definition.constant)
|
||||
(const_definition (identifier) @local.definition.constant)
|
||||
|
||||
(enum_definition "enum"
|
||||
. (identifier) @definition.enum
|
||||
"{" (identifier) @definition.constant "}")
|
||||
. (identifier) @local.definition.enum
|
||||
"{" (identifier) @local.definition.constant "}")
|
||||
|
||||
(senum_definition "senum"
|
||||
. (identifier) @definition.enum)
|
||||
. (identifier) @local.definition.enum)
|
||||
|
||||
(field (identifier) @definition.field)
|
||||
(field (identifier) @local.definition.field)
|
||||
|
||||
(function_definition (identifier) @definition.function)
|
||||
(function_definition (identifier) @local.definition.function)
|
||||
|
||||
(namespace_declaration
|
||||
"namespace" (namespace_scope)
|
||||
. (_) @definition.namespace
|
||||
. (_) @local.definition.namespace
|
||||
(namespace_uri)?)
|
||||
|
||||
(parameter (identifier) @definition.parameter)
|
||||
(parameter (identifier) @local.definition.parameter)
|
||||
|
||||
(struct_definition
|
||||
"struct" . (identifier) @definition.type)
|
||||
"struct" . (identifier) @local.definition.type)
|
||||
|
||||
(union_definition
|
||||
"union" . (identifier) @definition.type)
|
||||
"union" . (identifier) @local.definition.type)
|
||||
|
||||
(exception_definition
|
||||
"exception" . (identifier) @definition.type)
|
||||
"exception" . (identifier) @local.definition.type)
|
||||
|
||||
(service_definition
|
||||
"service" . (identifier) @definition.type)
|
||||
"service" . (identifier) @local.definition.type)
|
||||
|
||||
(interaction_definition
|
||||
"interaction" . (identifier) @definition.type)
|
||||
"interaction" . (identifier) @local.definition.type)
|
||||
|
||||
(typedef_identifier) @definition.type
|
||||
(typedef_identifier) @local.definition.type
|
||||
|
|
|
@ -9,31 +9,31 @@
|
|||
(for_expression)
|
||||
(let_expression)
|
||||
(function_declaration)
|
||||
] @scope
|
||||
] @local.scope
|
||||
; }}}
|
||||
|
||||
; Definitions {{{
|
||||
(type_declaration
|
||||
name: (identifier) @definition.type
|
||||
name: (identifier) @local.definition.type
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(parameters
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @definition.function
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
(primitive_declaration
|
||||
name: (identifier) @definition.function
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(variable_declaration
|
||||
name: (identifier) @definition.var
|
||||
name: (identifier) @local.definition.var
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
; }}}
|
||||
|
||||
; References {{{
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
; }}}
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
@ -12,45 +12,45 @@
|
|||
(set_filter)
|
||||
(set_map)
|
||||
(unbounded_quantification)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(choose (identifier) @definition.parameter)
|
||||
(choose (tuple_of_identifiers (identifier) @definition.parameter))
|
||||
(constant_declaration (identifier) @definition.constant)
|
||||
(constant_declaration (operator_declaration name: (_) @definition.constant))
|
||||
(choose (identifier) @local.definition.parameter)
|
||||
(choose (tuple_of_identifiers (identifier) @local.definition.parameter))
|
||||
(constant_declaration (identifier) @local.definition.constant)
|
||||
(constant_declaration (operator_declaration name: (_) @local.definition.constant))
|
||||
(function_definition
|
||||
name: (identifier) @definition.function
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
(lambda (identifier) @definition.parameter)
|
||||
(lambda (identifier) @local.definition.parameter)
|
||||
(module_definition
|
||||
name: (_) @definition.import
|
||||
name: (_) @local.definition.import
|
||||
(#set! "definition.import.scope" "parent"))
|
||||
(module_definition parameter: (identifier) @definition.parameter)
|
||||
(module_definition parameter: (operator_declaration name: (_) @definition.parameter))
|
||||
(module_definition parameter: (identifier) @local.definition.parameter)
|
||||
(module_definition parameter: (operator_declaration name: (_) @local.definition.parameter))
|
||||
(operator_definition
|
||||
name: (_) @definition.macro
|
||||
name: (_) @local.definition.macro
|
||||
(#set! "definition.macro.scope" "parent"))
|
||||
(operator_definition parameter: (identifier) @definition.parameter)
|
||||
(operator_definition parameter: (operator_declaration name: (_) @definition.parameter))
|
||||
(quantifier_bound (identifier) @definition.parameter)
|
||||
(quantifier_bound (tuple_of_identifiers (identifier) @definition.parameter))
|
||||
(unbounded_quantification (identifier) @definition.parameter)
|
||||
(variable_declaration (identifier) @definition.var)
|
||||
(operator_definition parameter: (identifier) @local.definition.parameter)
|
||||
(operator_definition parameter: (operator_declaration name: (_) @local.definition.parameter))
|
||||
(quantifier_bound (identifier) @local.definition.parameter)
|
||||
(quantifier_bound (tuple_of_identifiers (identifier) @local.definition.parameter))
|
||||
(unbounded_quantification (identifier) @local.definition.parameter)
|
||||
(variable_declaration (identifier) @local.definition.var)
|
||||
|
||||
; Proof scopes and definitions
|
||||
[
|
||||
(non_terminal_proof)
|
||||
(suffices_proof_step)
|
||||
(theorem)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(assume_prove (new (identifier) @definition.parameter))
|
||||
(assume_prove (new (operator_declaration name: (_) @definition.parameter)))
|
||||
(assumption name: (identifier) @definition.constant)
|
||||
(pick_proof_step (identifier) @definition.parameter)
|
||||
(take_proof_step (identifier) @definition.parameter)
|
||||
(assume_prove (new (identifier) @local.definition.parameter))
|
||||
(assume_prove (new (operator_declaration name: (_) @local.definition.parameter)))
|
||||
(assumption name: (identifier) @local.definition.constant)
|
||||
(pick_proof_step (identifier) @local.definition.parameter)
|
||||
(take_proof_step (identifier) @local.definition.parameter)
|
||||
(theorem
|
||||
name: (identifier) @definition.constant
|
||||
name: (identifier) @local.definition.constant
|
||||
(#set! "definition.constant.scope" "parent"))
|
||||
|
||||
; PlusCal scopes and definitions
|
||||
|
@ -59,30 +59,30 @@
|
|||
(pcal_macro)
|
||||
(pcal_procedure)
|
||||
(pcal_with)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(pcal_macro_decl parameter: (identifier) @definition.parameter)
|
||||
(pcal_proc_var_decl (identifier) @definition.parameter)
|
||||
(pcal_var_decl (identifier) @definition.var)
|
||||
(pcal_with (identifier) @definition.parameter)
|
||||
(pcal_macro_decl parameter: (identifier) @local.definition.parameter)
|
||||
(pcal_proc_var_decl (identifier) @local.definition.parameter)
|
||||
(pcal_var_decl (identifier) @local.definition.var)
|
||||
(pcal_with (identifier) @local.definition.parameter)
|
||||
|
||||
; Built-in PlusCal variables
|
||||
(pcal_algorithm_body
|
||||
[
|
||||
(_ (identifier_ref) @definition.var)
|
||||
(_ (_ (identifier_ref) @definition.var))
|
||||
(_ (_ (_ (identifier_ref) @definition.var)))
|
||||
(_ (_ (_ (_ (identifier_ref) @definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier_ref) @definition.var)))))
|
||||
(_ (identifier_ref) @local.definition.var)
|
||||
(_ (_ (identifier_ref) @local.definition.var))
|
||||
(_ (_ (_ (identifier_ref) @local.definition.var)))
|
||||
(_ (_ (_ (_ (identifier_ref) @local.definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier_ref) @local.definition.var)))))
|
||||
]
|
||||
(#any-of? @definition.var "self" "pc" "stack"))
|
||||
(#any-of? @local.definition.var "self" "pc" "stack"))
|
||||
|
||||
; References
|
||||
(identifier_ref) @reference
|
||||
((prefix_op_symbol) @reference)
|
||||
(bound_prefix_op symbol: (_) @reference)
|
||||
((infix_op_symbol) @reference)
|
||||
(bound_infix_op symbol: (_) @reference)
|
||||
((postfix_op_symbol) @reference)
|
||||
(bound_postfix_op symbol: (_) @reference)
|
||||
(bound_nonfix_op symbol: (_) @reference)
|
||||
(identifier_ref) @local.reference
|
||||
((prefix_op_symbol) @local.reference)
|
||||
(bound_prefix_op symbol: (_) @local.reference)
|
||||
((infix_op_symbol) @local.reference)
|
||||
(bound_infix_op symbol: (_) @local.reference)
|
||||
((postfix_op_symbol) @local.reference)
|
||||
(bound_postfix_op symbol: (_) @local.reference)
|
||||
(bound_nonfix_op symbol: (_) @local.reference)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[
|
||||
(table)
|
||||
(table_array_element)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(turtle_doc) @scope
|
||||
(turtle_doc) @local.scope
|
||||
|
||||
(subject
|
||||
[
|
||||
(prefixed_name)
|
||||
(iri_reference)
|
||||
] @definition.var)
|
||||
] @local.definition.var)
|
||||
|
||||
[
|
||||
(prefixed_name)
|
||||
(iri_reference)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
; inherits: ecma
|
||||
(required_parameter (identifier) @definition)
|
||||
(optional_parameter (identifier) @definition)
|
||||
(required_parameter (identifier) @local.definition)
|
||||
(optional_parameter (identifier) @local.definition)
|
||||
|
||||
; x => x
|
||||
(arrow_function
|
||||
parameter: (identifier) @definition.parameter)
|
||||
parameter: (identifier) @local.definition.parameter)
|
||||
|
||||
;; ({ a }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(shorthand_property_identifier_pattern) @definition.parameter))
|
||||
(shorthand_property_identifier_pattern) @local.definition.parameter))
|
||||
|
||||
;; ({ a: b }) => null
|
||||
(required_parameter
|
||||
(object_pattern
|
||||
(pair_pattern
|
||||
value: (identifier) @definition.parameter)))
|
||||
value: (identifier) @local.definition.parameter)))
|
||||
|
||||
;; ([ a ]) => null
|
||||
(required_parameter
|
||||
(array_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(required_parameter
|
||||
(rest_pattern
|
||||
(identifier) @definition.parameter))
|
||||
(identifier) @local.definition.parameter))
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
(assignment
|
||||
key: "LABEL"
|
||||
(value (content) @definition))
|
||||
(value (content) @local.definition))
|
||||
|
||||
(assignment
|
||||
key: "GOTO"
|
||||
(value (content) @reference))
|
||||
(value (content) @local.reference))
|
||||
|
||||
;; env vars
|
||||
|
||||
(assignment
|
||||
key: "ENV"
|
||||
(env_var) @definition.var)
|
||||
(env_var) @local.definition.var)
|
||||
|
||||
(match
|
||||
key: "ENV"
|
||||
(env_var) @reference)
|
||||
(env_var) @local.reference)
|
||||
|
||||
(var_sub (env_var) @reference)
|
||||
(var_sub (env_var) @local.reference)
|
||||
|
||||
;; misc
|
||||
|
||||
|
@ -26,4 +26,4 @@
|
|||
(attribute)
|
||||
(kernel_param)
|
||||
(seclabel)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(grammar) @scope
|
||||
(grammar) @local.scope
|
||||
|
||||
(definition) @definition
|
||||
(definition) @local.definition
|
||||
|
||||
(label_name) @definition.label
|
||||
(label_name) @local.definition.label
|
||||
|
||||
(identifier) @reference
|
||||
(identifier) @local.reference
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[
|
||||
(block)
|
||||
(metadata)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue