[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 206d849f72 012/417: add support for nix
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 206d849f72 012/417: add support for nix |
Date: |
Mon, 1 Jul 2024 10:02:05 -0400 (EDT) |
branch: elpa/treesit-fold
commit 206d849f723faff830ed74a75957cde8ee6252ab
Author: Junyi Hou <junyi.yi.hou@gmail.com>
Commit: Junyi Hou <junyi.yi.hou@gmail.com>
add support for nix
---
readme.org | 1 +
tree-sitter-fold.el | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/readme.org b/readme.org
index f55d4e4e48..0362522208 100644
--- a/readme.org
+++ b/readme.org
@@ -48,6 +48,7 @@ This variable determines how ~tree-sitter-fold~ should fold
each of the nodes de
- python
- R (need to compile [[https://github.com/r-lib/tree-sitter-r][tree-sitter-r]]
grammar, see [[Note on installing additional grammars]])
+- Nix (need to compile
[[https://github.com/cstrahan/tree-sitter-nix][tree-sitter-nix]], see [[Note no
installing additional grammars]])
- contribution of other languages are welcome!
* Contribution
diff --git a/tree-sitter-fold.el b/tree-sitter-fold.el
index 44fcf51556..91d065f5d8 100644
--- a/tree-sitter-fold.el
+++ b/tree-sitter-fold.el
@@ -31,7 +31,8 @@
(defcustom tree-sitter-fold-foldable-node-alist
'((python-mode . (function_definition class_definition))
- (ess-r-mode . (brace_list)))
+ (ess-r-mode . (brace_list))
+ (nix-mode . (attrset function)))
"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)
@@ -45,7 +46,7 @@
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
FOLDABLE-NODE-TYPE) and return the buffer positions of the beginning and end of
-the fold in a cons cell. See `tree-sitter-fold-range-python' for an example."
+the fold in a cons cell. See `tree-sitter-fold-range-python' for an example."
:type '(alist :key-type symbol
:value-type (alist :key-type symbol :value-type function))
:group 'tree-sitter-fold)
@@ -238,6 +239,13 @@ If the current syntax node is not foldable, do nothing."
(end (1- (tsc-node-end-position node))))
(cons beg end)))
+(defun tree-sitter-fold-range-nix (node)
+ "Return the fold range for `attrset' NODE in Nix express language."
+ (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)
;;; tree-sitter-fold.el ends here
- [nongnu] elpa/treesit-fold 648f75ef06 342/417: fix(indicators): Add option for rendering method, (continued)
- [nongnu] elpa/treesit-fold 648f75ef06 342/417: fix(indicators): Add option for rendering method, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold db35c17409 331/417: lint, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c70ac04ea5 358/417: Fixed linting warnings, untabified, tested locally with eask., ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4ef65016fd 396/417: fix: Respect same line folding from close all, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold dd36cd388a 360/417: Untabified, reorganized alphabetically: parsers, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4e9492c2f8 370/417: fix changelog, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 714d645b68 337/417: fix: error Invalid face box quote (:line-width -1 :style 'pressed-button), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c8638d41be 372/417: feat(Zig): Add more Zig folding rules, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c45985d720 330/417: fix: Remove unused function, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 45f20588f0 304/417: docs(README.md): Add development languages, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 206d849f72 012/417: add support for nix,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 13941aa169 016/417: Add support for Go structs, interfaces, methods and functions, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 665dd1e46d 017/417: Merge pull request #1 from jakejx/go-support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2b10944ca4 027/417: Remove old readme, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a3b5c852ac 044/417: WIP js support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold bf8fef92c1 050/417: Update core, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c89ccafa7d 052/417: Simplify, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5551d9ebd8 086/417: Fix toggle, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b429fd33dc 087/417: Move face, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 4f281a727f 097/417: Use autoload instead, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a68579c4f7 098/417: Fix ind overlays, ELPA Syncer, 2024/07/01