; Tree-sitter text objects for Lux
; Use with nvim-treesitter-textobjects

; Function text objects
(function_declaration) @function.outer
(function_declaration body: (_) @function.inner)

; Class/type text objects (treat type declarations like classes)
(type_declaration) @class.outer
(type_declaration definition: (_) @class.inner)

; Parameter text objects
(parameters) @parameter.outer
(parameter) @parameter.inner

; Block text objects
(block_expression) @block.outer
(block_expression (_) @block.inner)

; Match arm text objects (like case statements)
(match_arm) @statement.outer
(match_arm consequence: (_) @statement.inner)

; Conditional text objects
(if_expression) @conditional.outer
(if_expression consequence: (_) @conditional.inner)

; Comment text objects
(line_comment) @comment.outer
(doc_comment) @comment.outer

; Call text objects
(call_expression) @call.outer
(call_expression arguments: (_) @call.inner)

; Effect/handler text objects (Lux-specific)
(effect_declaration) @effect.outer
(effect_declaration body: (_) @effect.inner)

(handler_declaration) @handler.outer
(handler_declaration body: (_) @handler.inner)

; Loop text objects (using recursion as loops in Lux)
(match_expression) @loop.outer
(match_expression body: (_) @loop.inner)

; Assignment text objects
(let_declaration) @assignment.outer
(let_declaration value: (_) @assignment.inner)

; Attribute/property text objects
(property_clause) @attribute.outer

; Return value (last expression in block)
(block_expression (_) @return.inner . "}")
