[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 362fc74774 011/417: R: fold brace_list instea
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 362fc74774 011/417: R: fold brace_list instead |
Date: |
Mon, 1 Jul 2024 10:02:04 -0400 (EDT) |
branch: elpa/treesit-fold
commit 362fc747745c860156159bfff4af142d33cdb260
Author: Junyi Hou <junyi.yi.hou@gmail.com>
Commit: Junyi Hou <junyi.yi.hou@gmail.com>
R: fold brace_list instead
---
tree-sitter-fold.el | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/tree-sitter-fold.el b/tree-sitter-fold.el
index 40d0ee51d4..44fcf51556 100644
--- a/tree-sitter-fold.el
+++ b/tree-sitter-fold.el
@@ -31,7 +31,7 @@
(defcustom tree-sitter-fold-foldable-node-alist
'((python-mode . (function_definition class_definition))
- (ess-r-mode . (function_definition)))
+ (ess-r-mode . (brace_list)))
"An alist of (mode . (list of tree-sitter-nodes considered foldable in this
mode))."
:type '(alist :key-type symbol :value-type (repeat symbol))
:group 'tree-sitter-fold)
@@ -39,7 +39,8 @@
(defcustom tree-sitter-fold-range-alist
'((python-mode . ((function_definition . tree-sitter-fold-range-python)
(class_definition . tree-sitter-fold-range-python)))
- (ess-r-mode . ((function_definition . tree-sitter-fold-range-r))))
+ (ess-r-mode . ((brace_list . tree-sitter-fold-range-r)))
+ (nix-mode . ((attrset . tree-sitter-fold-range-nix))))
"An alist of (major-mode . (foldable-node-type . function)).
FUNCTION is used to determine where the beginning and end for
FOLDABLE-NODE-TYPE
in MAJOR-MODE. It should take a single argument (the syntax node with type
@@ -232,14 +233,10 @@ If the current syntax node is not foldable, do nothing."
(cons beg end)))
(defun tree-sitter-fold-range-r (node)
- "Return the fold range for `function_definition' NODE in R."
- (let ((node (tsc-get-nth-named-child node 0)))
- (while (not (eq (tsc-node-type node) 'brace_list))
- (setq node (tsc-get-next-named-sibling node)))
- ;; now node is a brace_list
- (let ((beg (tsc-node-end-position (tsc-get-nth-child node 0)))
- (end (1- (tsc-node-end-position node))))
- (cons beg end))))
+ "Return the fold range for `brace_list' NODE in R."
+ (let ((beg (tsc-node-end-position (tsc-get-nth-child node 0)))
+ (end (1- (tsc-node-end-position node))))
+ (cons beg end)))
(provide 'tree-sitter-fold)
- [nongnu] elpa/treesit-fold 7065c6b28f 122/417: Apply macro, (continued)
- [nongnu] elpa/treesit-fold 7065c6b28f 122/417: Apply macro, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f49df1ea3d 124/417: Update doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6f15c1735a 125/417: Support javascript comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold eeb9c03bcc 127/417: Fix conitouse line, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c33e5e7e0c 128/417: Temporily disable csharp, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6b6f30eb4a 142/417: Add emoji, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6aabbc6256 147/417: Update doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e6ac78f0e2 154/417: SCALE AND CENTER, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a806886568 161/417: Update support language list, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2409596f33 004/417: readme: fix typo, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 362fc74774 011/417: R: fold brace_list instead,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold f0858f1dbc 009/417: add support for R, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b3faaaa40d 015/417: support folding nix functions, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold de5ad4b2f2 063/417: Split uitl, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d07b2bae49 065/417: Complete indicators, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d2c13aac81 069/417: Clean compile, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4d4526ffb3 073/417: Update core, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2dfd8c1656 083/417: Add support lang, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5c9981872e 095/417: Restrict one, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2ba784bea0 093/417: Fix externals, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f13f0c371b 102/417: Core, ELPA Syncer, 2024/07/01