From e0d861b23ace1702eb3d0c2e49ee11ef8771c82d Mon Sep 17 00:00:00 2001 From: Peter Cardenas <16930781+PeterCardenas@users.noreply.github.com> Date: Sun, 20 Apr 2025 20:20:34 -0700 Subject: [PATCH] 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. --- queries/ecma/folds.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/queries/ecma/folds.scm b/queries/ecma/folds.scm index a348f3444..7572479f7 100644 --- a/queries/ecma/folds.scm +++ b/queries/ecma/folds.scm @@ -22,3 +22,11 @@ (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))