nvim-treesitter/runtime/queries/inko/locals.scm
Yorick Peterse 3ab4f2d2d2 feat(inko): update parser for let pattern matching
Commit 9d7ed4 of the Inko tree-sitter grammar introduces support for
pattern matching in `let` expressions. This requires some corresponding
changes to the "local" queries to correctly define local variables. This
is done by simply defining locals for all "identifier_pattern" nodes,
instead of only doing this for "define_variable" nodes.
2025-10-07 10:00:15 +02:00

61 lines
1.1 KiB
Scheme

[
(method)
(block)
] @local.scope
((method
name: _ @local.definition.method) @local.scope
(#set! definition.function.scope "parent"))
(external_function
name: _ @local.definition.function)
(argument
name: _ @local.definition.parameter)
(identifier_pattern
name: _ @local.definition.var)
(define_constant
name: _ @local.definition.constant)
(define_field
name: _ @local.definition.field)
(named_argument
name: _ @local.definition.parameter)
((class
modifier: (modifier
"enum")
name: _ @local.definition.enum) @local.scope
(#set! definition.type.scope "parent"))
(class
modifier: (modifier
"enum")
body: (class_body
(define_case
name: _ @local.definition.field)))
((class
name: _ @local.definition.type) @local.scope
(#set! definition.type.scope "parent"))
((trait
name: _ @local.definition.type) @local.scope
(#set! definition.type.scope "parent"))
(import
(symbols
[
(identifier)
(constant)
(self)
] @local.definition.import))
(identifier) @local.reference
(field) @local.reference
(constant) @local.reference