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

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

[nongnu] elpa/treesit-fold a474fd6b42 285/417: feat: Add Jai support (#7


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold a474fd6b42 285/417: feat: Add Jai support (#71)
Date: Mon, 1 Jul 2024 10:02:36 -0400 (EDT)

branch: elpa/treesit-fold
commit a474fd6b4250d51350d7050c9726059716997098
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>

    feat: Add Jai support (#71)
    
    * feat: Add Jai support
    
    * Changelog
---
 CHANGELOG.md       |  1 +
 README.md          |  2 +-
 ts-fold-parsers.el | 10 +++++++++-
 ts-fold-summary.el |  1 +
 ts-fold.el         |  4 +++-
 5 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea50db0e23..4ed86936d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for 
recommendations on how
 * Add TOML support (#68)
 * fix: Don't fold lint comment when only 1 line (#69) 
 * Add Kotlin support (#70)
+* Add Jai support (#71)
 
 ## 0.1.0
 > Released Oct 18, 2021
diff --git a/README.md b/README.md
index 5c8bb1069d..086ef36680 100644
--- a/README.md
+++ b/README.md
@@ -123,7 +123,7 @@ These languages are fairly complete:
 - Elisp / Elixir
 - Go
 - Haskell / HTML
-- Java / JavaScript / JSX / JSON / Julia
+- Jai / Java / JavaScript / JSX / JSON / Julia
 - Kotlin
 - Lua
 - Markdown
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 24412c5e68..5e33767f36 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -180,6 +180,13 @@
   '((element . ts-fold-range-html)
     (comment . (ts-fold-range-seq 1 -1))))
 
+(defun ts-fold-parsers-jai ()
+  "Rule set for Jai."
+  '((imperative_scope . ts-fold-range-seq)
+    (data_scope       . ts-fold-range-seq)
+    (block_comment    . ts-fold-range-block-comment)
+    (inline_comment   . ts-fold-range-c-like-comment)))
+
 (defun ts-fold-parsers-java ()
   "Rule set for Java."
   '((switch_block                    . ts-fold-range-seq)
@@ -192,7 +199,8 @@
     (annotation_type_body            . ts-fold-range-seq)
     (interface_body                  . ts-fold-range-seq)
     (array_initializer               . ts-fold-range-seq)
-    (block_comment                   . (ts-fold-range-seq 1 -1))))
+    (block_comment                   . ts-fold-range-block-comment)
+    (line_comment                    . ts-fold-range-c-like-comment)))
 
 (defun ts-fold-parsers-javascript ()
   "Rule set for JavaScript."
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 61bddad8d3..78bd488e2b 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -215,6 +215,7 @@ type of content by checking the word boundary's existence."
     (go-mode           . ts-fold-summary-go)
     (haskell-mode      . ts-fold-summary-lua-doc)
     (html-mode         . ts-fold-summary-xml)
+    (jai-mode          . ts-fold-summary-c)
     (java-mode         . ts-fold-summary-javadoc)
     (javascript-mode   . ts-fold-summary-javadoc)
     (js-mode           . ts-fold-summary-javadoc)
diff --git a/ts-fold.el b/ts-fold.el
index 8e93ef4282..2d787c3389 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -73,6 +73,7 @@
     (go-mode         . ,(ts-fold-parsers-go))
     (haskell-mode    . ,(ts-fold-parsers-haskell))
     (html-mode       . ,(ts-fold-parsers-html))
+    (jai-mode        . ,(ts-fold-parsers-jai))
     (java-mode       . ,(ts-fold-parsers-java))
     (javascript-mode . ,(ts-fold-parsers-javascript))
     (js-mode         . ,(ts-fold-parsers-javascript))
@@ -318,7 +319,8 @@ If the current node is not folded or not foldable, do 
nothing."
   (ts-fold--ensure-ts
     (when-let* ((node (ts-fold--foldable-node-at-pos))
                 (ov (ts-fold-overlay-at node)))
-      (delete-overlay ov))))
+      (delete-overlay ov)
+      t)))
 
 ;;;###autoload
 (defun ts-fold-open-recursively ()



reply via email to

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