nvim-treesitter/queries/ecma/folds.scm
Peter Cardenas e0d861b23a
fix(folds.ecma): separate folds for if/else/else if
With large if/else/else if blocks, it's difficult to notice that folding
an if statement also folds the else and else if statements along with
them. By allowing the folds of the if, else, and else if statements to
be separate, the folds are easier to distinguish and are more granular.
2025-04-20 20:59:08 -07:00

32 lines
602 B
Scheme

[
(arguments)
(for_in_statement)
(for_statement)
(while_statement)
(arrow_function)
(function_expression)
(function_declaration)
(class_declaration)
(method_definition)
(do_statement)
(with_statement)
(switch_statement)
(switch_case)
(switch_default)
(import_statement)+
(if_statement)
(try_statement)
(catch_clause)
(array)
(object)
(generator_function)
(generator_function_declaration)
] @fold
(if_statement
consequence: (statement_block) @fold
(#offset! @fold 0 0 -1 0))
(if_statement
alternative: (else_clause) @fold
(#offset! @fold 0 0 -1 0))