branch: elpa/treesit-fold
commit aa37d3bb5fe05ffa693ab678fb0272025a83a0c7
Author: Jen-Chieh Shen <[email protected]>
Commit: GitHub <[email protected]>

    fix: Improve Elixir UX (#78)
    
    * fix: Improve Elixir UX
    
    * Changelog
---
 CHANGELOG.md       |  1 +
 ts-fold-parsers.el | 12 ++++++------
 ts-fold.el         |  3 +++
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fae8f63aa8..f3bbfbe5f0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for 
recommendations on how
 > Released N/A
 
 * Add Noir support (#77)
+* Improve Elixir UX (#78)
 
 ## 0.2.0
 > Released Sep 01, 2023
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 3bd2059b55..bf862327d4 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -161,13 +161,13 @@
 
 (defun ts-fold-parsers-elixir ()
   "Rules set for Elixir."
-  '((list . ts-fold-range-seq)
-    (map . ts-fold-range-seq)
-    (tuple . ts-fold-range-seq)
+  '((list     . ts-fold-range-seq)
+    (map      . ts-fold-range-seq)
+    (tuple    . ts-fold-range-seq)
+    (do_block . ts-fold-range-elixir)
     (comment
      . (lambda (node offset)
-         (ts-fold-range-line-comment node offset "#")))
-    (do_block . ts-fold-range-elixir)))
+         (ts-fold-range-line-comment node offset "#")))))
 
 (defun ts-fold-parsers-gdscript ()
   "Rule set for GGScript."
@@ -179,7 +179,7 @@
 (defun ts-fold-parsers-go ()
   "Rule set for Go."
   '((block                  . ts-fold-range-seq)
-    (comment                . ts-fold-range-seq)
+    (comment                . ts-fold-range-c-like-comment)
     (const_declaration      . (lambda (node offset)
                                 (ts-fold-range-markers node offset "(" ")")))
     (field_declaration_list . ts-fold-range-seq)
diff --git a/ts-fold.el b/ts-fold.el
index 41fb901f2a..80a7ed689b 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -587,7 +587,10 @@ more information."
   (when-let* ((end-child (ts-fold-last-child node))
               (do-child (tsc-get-nth-child node 1))
               (beg (tsc-node-start-position do-child))
+              (beg (ts-fold--last-eol beg))
               (end (tsc-node-start-position end-child)))
+    (when ts-fold-on-next-line  ; display nicely
+      (setq end (ts-fold--last-eol end)))
     (ts-fold--cons-add (cons beg end) offset)))
 
 (defun ts-fold-range-haskell-function (node offset)

Reply via email to