[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 6a57bd945d 364/417: fix(cmake): Enhance body
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 6a57bd945d 364/417: fix(cmake): Enhance body folding |
Date: |
Mon, 1 Jul 2024 10:03:05 -0400 (EDT) |
branch: elpa/treesit-fold
commit 6a57bd945d7e7d8ac92950d6ded478847e460a85
Author: JenChieh <jcs090218@gmail.com>
Commit: JenChieh <jcs090218@gmail.com>
fix(cmake): Enhance body folding
---
ts-fold-parsers.el | 3 ++-
ts-fold.el | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 297cc3d233..8c9826f271 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -83,6 +83,7 @@
(declare-function ts-fold-range-ocaml-value-definition "ts-fold.el")
(declare-function ts-fold-range-org-body "ts-fold.el")
(declare-function ts-fold-range-clojure-function "ts-fold.el")
+(declare-function ts-fold-range-cmake-body "ts-fold.el")
(declare-function ts-fold-range-pascal-comment "ts-fold.el")
(declare-function ts-fold-range-python-def "ts-fold.el")
(declare-function ts-fold-range-python-expression-statement "ts-fold.el")
@@ -173,7 +174,7 @@
(defun ts-fold-parsers-cmake ()
"Rule set for CMake."
- '((body . ts-fold-range-seq)
+ '((body . ts-fold-range-cmake-body)
(line_comment
. (lambda (node offset)
(ts-fold-range-line-comment node offset "#")))))
diff --git a/ts-fold.el b/ts-fold.el
index 31c11493ca..e01075ac76 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -654,6 +654,17 @@ more information."
(setq beg (ts-fold--last-eol beg)))
(ts-fold--cons-add (cons beg end) offset)))
+(defun ts-fold-range-cmake-body (node offset)
+ "Return the fold range for `body' NODE in CMake.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((beg (tsc-node-start-position node))
+ (end (tsc-node-end-position node)))
+ (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-elisp-function (node offset)
"Return the fold range for `macro_definition' and `function_definition' NODE
in Elisp.
- [nongnu] elpa/treesit-fold 1d8d9352a1 369/417: feat: Add Svelte support, (continued)
- [nongnu] elpa/treesit-fold 1d8d9352a1 369/417: feat: Add Svelte support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c0e9bb7f3e 344/417: fix: Improve Julia rules, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9f48ef560c 322/417: fix: render all frames, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 12ae1d0457 356/417: Added section & environment folding to latex-parser, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold ee0c0eb252 312/417: fix(make): Folding recipe, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 57c1bb8e0a 317/417: feat: Add Arduino support (#95), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 15811f4465 386/417: fix: on fold hook in recursive open, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9945282f03 349/417: Added a matlab parser for folding., ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a549e4050c 367/417: chore: Test 29.2, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c6014608c7 365/417: fix(parser): Support Assembly's block comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6a57bd945d 364/417: fix(cmake): Enhance body folding,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 0fa1378c9b 407/417: Remove dependency in `fringe-helper.el` (#7), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7c8e1a5467 406/417: fix: In case the AST doesn't get refreshed, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e2d4cb9fac 411/417: docs: Add Gleam to supported list, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold af3a57b656 413/417: docs: Changelog bump, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 75d6f9ed31 253/417: Add extra folding definitions for golang (#42), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d2f88cbf1b 123/417: Add parser, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 1b54cdc9fc 139/417: Update doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 3d1be710a6 200/417: Update README.md, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 1bc43aa561 254/417: updated line-reminder compatibility in README (#50), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 27c6bc4819 265/417: feature(parser): Add support for python docstring (#58), ELPA Syncer, 2024/07/01