branch: elpa/treesit-fold
commit 3dd7c477fb08874d1bbbcb2588029e7ebd4b445f
Author: Jen-Chieh Shen <[email protected]>
Commit: GitHub <[email protected]>
feat: Add CMake support (#86)
---
CHANGELOG.md | 1 +
README.md | 2 +-
ts-fold-parsers.el | 7 +++++++
ts-fold-summary.el | 1 +
ts-fold.el | 1 +
5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3c6713d927..dd67c52a1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for
recommendations on how
* Add Zig support (#82)
* Add Erlang support (#83)
* Add basic Pascal support (#84)
+* Add CMake support (#85)
## 0.2.0
> Released Sep 01, 2023
diff --git a/README.md b/README.md
index 0825875f19..e59085a87f 100644
--- a/README.md
+++ b/README.md
@@ -113,7 +113,7 @@ If evil mode is loaded, then these commands are also added
to the evil folding l
These languages are fairly complete:
- Bash / Beancount
-- C / C++ / C# / Clojure / CSS
+- C / C++ / C# / Clojure / CMake / CSS
- Dart
- Elisp / Elixir / Erlang
- GDScript / Go
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index e666b21bbc..27d0951306 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -124,6 +124,13 @@
. (lambda (node offset)
(ts-fold-range-line-comment node offset ";;")))))
+(defun ts-fold-parsers-cmake ()
+ "Rule set for CMake."
+ '((body . ts-fold-range-seq)
+ (line_comment
+ . (lambda (node offset)
+ (ts-fold-range-line-comment node offset "#")))))
+
(defun ts-fold-parsers-csharp ()
"Rule set for C#."
'((block . ts-fold-range-seq)
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 22c2ce84f0..1908eb381b 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -218,6 +218,7 @@ type of content by checking the word boundary's existence."
(beancount-mode . ts-fold-summary-elisp)
(c-mode . ts-fold-summary-c)
(c++-mode . ts-fold-summary-c)
+ (cmake-mode . ts-fold-summary-ruby-doc)
(clojure-mode . ts-fold-summary-elisp)
(csharp-mode . ts-fold-summary-csharp)
(css-mode . ts-fold-summary-javadoc)
diff --git a/ts-fold.el b/ts-fold.el
index 1aebeecad0..bb32536260 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -64,6 +64,7 @@
(c-mode . ,(ts-fold-parsers-c))
(c++-mode . ,(ts-fold-parsers-c++))
(caml-mode . ,(ts-fold-parsers-ocaml))
+ (cmake-mode . ,(ts-fold-parsers-cmake))
(clojure-mode . ,(ts-fold-parsers-clojure))
(csharp-mode . ,(ts-fold-parsers-csharp))
(css-mode . ,(ts-fold-parsers-css))