branch: elpa/treesit-fold
commit 731adc16078e4d01314fa593a5195058c983bb0a
Author: JenChieh <[email protected]>
Commit: JenChieh <[email protected]>

    fix(asm): Enhance assembly comment's folding
---
 ts-fold-parsers.el | 8 +++++++-
 ts-fold-summary.el | 2 ++
 ts-fold.el         | 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 254ce720e0..76f1fab2a4 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -123,7 +123,13 @@
   '((label . ts-fold-range-asm-label)
     (line_comment
      . (lambda (node offset)
-         (ts-fold-range-line-comment node offset ";;")))))
+         (let ((text (tsc-node-text node)))
+           (cond ((string-prefix-p ";;" text)
+                  (ts-fold-range-line-comment node offset ";;"))
+                 ((string-prefix-p "#" text)
+                  (ts-fold-range-line-comment node offset "#"))
+                 (t
+                  (ts-fold-range-c-like-comment node offset))))))))
 
 (defun ts-fold-parsers-bash ()
   "Rule set for Bash."
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index dcf4a9fcfa..d8e40eeb9d 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -227,9 +227,11 @@ type of content by checking the word boundary's existence."
 (defcustom ts-fold-summary-parsers-alist
   `((actionscript-mode      . ts-fold-summary-javadoc)
     (arduino-mode           . ts-fold-summary-c)
+    (asm-mode               . ts-fold-summary-elisp)
     (fasm-mode              . ts-fold-summary-elisp)
     (masm-mode              . ts-fold-summary-elisp)
     (nasm-mode              . ts-fold-summary-elisp)
+    (gas-mode               . ts-fold-summary-elisp)
     (bat-mode               . ts-fold-summary-batch)
     (beancount-mode         . ts-fold-summary-elisp)
     (c-mode                 . ts-fold-summary-c)
diff --git a/ts-fold.el b/ts-fold.el
index 54cc130dd2..7c47eb7947 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -62,9 +62,11 @@
   `((actionscript-mode      . ,(ts-fold-parsers-actionscript))
     (agda-mode              . ,(ts-fold-parsers-agda))
     (arduino-mode           . ,(ts-fold-parsers-arduino))
+    (asm-mode               . ,(ts-fold-parsers-asm))
     (fasm-mode              . ,(ts-fold-parsers-asm))
     (masm-mode              . ,(ts-fold-parsers-asm))
     (nasm-mode              . ,(ts-fold-parsers-asm))
+    (gas-mode               . ,(ts-fold-parsers-asm))
     (beancount-mode         . ,(ts-fold-parsers-beancount))
     (c-mode                 . ,(ts-fold-parsers-c))
     (c++-mode               . ,(ts-fold-parsers-c++))

Reply via email to