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

    feat: Add RON support (#38)
---
 CHANGELOG.md            |  1 +
 README.md               |  2 +-
 treesit-fold-parsers.el | 12 ++++++++++++
 treesit-fold-summary.el |  1 +
 treesit-fold.el         |  1 +
 5 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9e71c7eebc..41aeb21096d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for 
recommendations on how
 * feat: Add basic `Magik` support 
([`76bba52`](../../commit/76bba5243883f6c8bff51c744c31e287a045a9f5))
 * feat: Add `GraphQL` support 
([`c85762f`](../../commit/c85762f4585e93e5e372b39355d357261431e983))
 * Enable folding for sequence items ([#35](../../pull/35))
+* feat: Add RON support ([#38](../../pull/38))
 
 ## 0.2.0
 > Released Feb 12, 2025
diff --git a/README.md b/README.md
index 59cc48365d9..4ae627380e0 100644
--- a/README.md
+++ b/README.md
@@ -137,7 +137,7 @@ These languages are fairly complete:
 - Ninja / Nix / Noir
 - OCaml / Org
 - Perl / PHP / Python
-- R / Ruby / Rust / reStructuredText
+- R / RON/ Ruby / Rust / reStructuredText
 - Scala / Scheme / SQL / Svelte / Swift
 - TOML / TypeScript / TSX
 - Verilog / VHDL / Vimscript
diff --git a/treesit-fold-parsers.el b/treesit-fold-parsers.el
index aa2b6a46a11..d2583903711 100644
--- a/treesit-fold-parsers.el
+++ b/treesit-fold-parsers.el
@@ -626,6 +626,18 @@
   "Rule set for R."
   '((brace_list . treesit-fold-range-seq)))
 
+(defun treesit-fold-parsers-ron ()
+  "Rule set for RON."
+  '((array  . treesit-fold-range-seq)
+    (map    . treesit-fold-range-seq)
+    (struct . treesit-fold-range-seq)
+    (line_comment
+     . (lambda (node offset)
+         (treesit-fold-range-line-comment node
+                                          (treesit-fold--cons-add offset '(0 . 
-1))
+                                          "///")))
+    (block_comment . treesit-fold-range-block-comment)))
+
 (defun treesit-fold-parsers-rst ()
   "Rule set for reStructuredText."
   '((body    . treesit-fold-range-rst-body)
diff --git a/treesit-fold-summary.el b/treesit-fold-summary.el
index 5b42bf04f5b..9318b240f4a 100644
--- a/treesit-fold-summary.el
+++ b/treesit-fold-summary.el
@@ -263,6 +263,7 @@ type of content by checking the word boundary's existence."
     (python-mode            . treesit-fold-summary-python-doc)
     (qss-mode               . treesit-fold-summary-css)
     (rjsx-mode              . treesit-fold-summary-javadoc)
+    (ron-mode               . treesit-fold-summary-rust-doc)
     (rst-mode               . treesit-fold-summary-rst-doc)
     (ruby-mode              . treesit-fold-summary-ruby-doc)
     (rust-mode              . treesit-fold-summary-rust-doc)
diff --git a/treesit-fold.el b/treesit-fold.el
index 3d7a8f4ef05..b5d87daab52 100644
--- a/treesit-fold.el
+++ b/treesit-fold.el
@@ -171,6 +171,7 @@
     (python-ts-mode         . ,(treesit-fold-parsers-python))
     (qss-mode               . ,(treesit-fold-parsers-qss))
     (rjsx-mode              . ,(treesit-fold-parsers-javascript))
+    (ron-mode               . ,(treesit-fold-parsers-ron))
     (rst-mode               . ,(treesit-fold-parsers-rst))
     (ruby-mode              . ,(treesit-fold-parsers-ruby))
     (ruby-ts-mode           . ,(treesit-fold-parsers-ruby))

Reply via email to