[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold ae12dd8717 217/417: Support elixir (#10)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold ae12dd8717 217/417: Support elixir (#10) |
Date: |
Mon, 1 Jul 2024 10:02:27 -0400 (EDT) |
branch: elpa/treesit-fold
commit ae12dd8717730e6908c3e930a5e2889767be1426
Author: mohammedzeglam-pg <56762707+mohammedzeglam-pg@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Support elixir (#10)
* Support elixir
* Add Elixir to supported languages in README
* aliast in alphabetic order
---
README.md | 2 +-
ts-fold-parsers.el | 11 ++++++++++-
ts-fold.el | 14 +++++++++++++-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 40121cf535..cecbd84862 100644
--- a/README.md
+++ b/README.md
@@ -81,12 +81,12 @@ then in Emacs:
* R / Ruby / Rust
* Scala / Swift
* TypeScript / TSX
+* Elixir
> These languages are in development:
* Agda
* Elm
-* Elixir
* Emacs Lisp
* XML (upstream)
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 956391ea3d..0139f447aa 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -48,6 +48,7 @@
(declare-function ts-fold-range-python "ts-fold.el")
(declare-function ts-fold-range-ruby "ts-fold.el")
(declare-function ts-fold-range-rust-macro "ts-fold.el")
+(declare-function ts-fold-range-elixir "ts-fold.el")
;;
;; (@* "Parsers" )
@@ -217,6 +218,14 @@
(defun ts-fold-parsers-typescript ()
"Rule sets for TypeScript."
(append (ts-fold-parsers-javascript)))
-
+(defun ts-fold-parsers-elixir ()
+ "Rules sets for Elixir."
+ '((list . ts-fold-range-seq)
+ (map . ts-fold-range-seq)
+ (tuple . ts-fold-range-seq)
+ (comment
+ . (lambda (node offset)
+ (ts-fold-range-line-comment node offset "#")))
+ (do_block .ts-fold-range-elixir)))
(provide 'ts-fold-parsers)
;;; ts-fold-parsers.el ends here
diff --git a/ts-fold.el b/ts-fold.el
index 2a0d5aa668..5ea0393d8d 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -65,7 +65,7 @@ The alist is in form of (major-mode . (foldable-node-type)).")
;; alphabetically sorted
(defcustom ts-fold-range-alist
`((agda-mode . ,(ts-fold-parsers-agda))
- (sh-mode . ,(ts-fold-parsers-bash))
+ (elixir-mode . ,(ts-fold-parsers-elixir))
(c-mode . ,(ts-fold-parsers-c))
(c++-mode . ,(ts-fold-parsers-c++))
(csharp-mode . ,(ts-fold-parsers-csharp))
@@ -87,6 +87,7 @@ The alist is in form of (major-mode . (foldable-node-type)).")
(ruby-mode . ,(ts-fold-parsers-ruby))
(rust-mode . ,(ts-fold-parsers-rust))
(rustic-mode . ,(ts-fold-parsers-rust))
+ (sh-mode . ,(ts-fold-parsers-bash))
(scala-mode . ,(ts-fold-parsers-scala))
(swift-mode . ,(ts-fold-parsers-swift))
(typescript-mode . ,(ts-fold-parsers-typescript)))
@@ -483,5 +484,16 @@ more information."
(end (1+ (tsc-node-start-position last_bracket))))
(ts-fold--cons-add (cons beg end) offset)))
+(defun ts-fold-range-elixir (node offset)
+ "Return the fold range for `function' `module' NODE in Elixir.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((children (tsc-count-children node))
+ (end_child (tsc-get-nth-child node (- children 1)))
+ (do_child (tsc-get-nth-child node 1))
+ (beg (tsc-node-start-position do_child))
+ (end (tsc-node-start-position end_child)))
+ (ts-fold--cons-add (cons beg end) offset)))
(provide 'ts-fold)
;;; ts-fold.el ends here
- [nongnu] elpa/treesit-fold 03872ff486 169/417: Update readme, (continued)
- [nongnu] elpa/treesit-fold 03872ff486 169/417: Update readme, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f1297ee040 170/417: Add elpa badge, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7c2b421d04 163/417: Fill gap, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9d48ee7937 176/417: Update CI, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 28ec4b244f 192/417: Update ts-fold.el, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 53b78381e9 190/417: Fix installation instruction for straight, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e4f47602eb 197/417: Update ts-fold.el, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5be52cde9c 207/417: up, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 41103496f2 206/417: up, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 551bfeb13a 211/417: doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold ae12dd8717 217/417: Support elixir (#10),
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 54babe5336 222/417: docs(CHANGELOG): update, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 0d884a4217 224/417: refactor(checkdoc): Fix checkdoc warnings (#23), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 1cb784167a 235/417: Add FUNDING.yml, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c3da5520b9 237/417: tests(test.yml): Add test for Emacs 28.2, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 85db0117ea 240/417: tests: Avoid actions' warnings, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a64f5252a6 244/417: Add .dir-locals.el (#40), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9776e2fa2c 247/417: Update copyright year, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 56e6743bac 252/417: feat: Improve folding for C preproc operators (#46), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9d9e0c5cf7 257/417: Add more folding definitions (#51), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 54d12c9822 281/417: feat: Add TOML support (#68), ELPA Syncer, 2024/07/01