emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/treesit-fold ee0c0eb252 312/417: fix(make): Folding recipe


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold ee0c0eb252 312/417: fix(make): Folding recipe
Date: Mon, 1 Jul 2024 10:02:55 -0400 (EDT)

branch: elpa/treesit-fold
commit ee0c0eb25266308a795c741c6ef177149339f17c
Author: JenChieh <jcs090218@gmail.com>
Commit: JenChieh <jcs090218@gmail.com>

    fix(make): Folding recipe
---
 ts-fold-parsers.el |  3 ++-
 ts-fold.el         | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 0b3193c472..0d9aaf5d68 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -61,6 +61,7 @@
 (declare-function ts-fold-range-lua-else "ts-fold.el")
 (declare-function ts-fold-range-lua-do-loop "ts-fold.el")
 (declare-function ts-fold-range-lua-repeat "ts-fold.el")
+(declare-function ts-fold-range-make-recipe "ts-fold.el")
 (declare-function ts-fold-range-ocaml "ts-fold.el")
 (declare-function ts-fold-range-clojure-function "ts-fold.el")
 (declare-function ts-fold-range-pascal-comment "ts-fold.el")
@@ -317,7 +318,7 @@
 
 (defun ts-fold-parsers-make ()
   "Rule set for Make."
-  '((recipe . (ts-fold-range-seq -1 -1))
+  '((recipe . ts-fold-range-make-recipe)
     (comment
      . (lambda (node offset)
          (ts-fold-range-line-comment node offset "#")))))
diff --git a/ts-fold.el b/ts-fold.el
index ad9b61eeff..1d78435cea 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -822,6 +822,16 @@ more information."
       (setq end (ts-fold--last-eol end)))
     (ts-fold--cons-add (cons beg end) offset)))
 
+(defun ts-fold-range-make-recipe (node offset)
+  "Define fold range for `recipe' in Make.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+  (when-let* ((last-child (ts-fold-last-child node))
+              (beg (tsc-node-start-position node))
+              (end (tsc-node-end-position last-child)))
+    (ts-fold--cons-add (cons beg end) offset)))
+
 ;;+ OCaml
 
 (defun ts-fold-range-ocaml-comment (node offset)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]