[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold eb714e2c21 408/417: feat: Add Gleam support (
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold eb714e2c21 408/417: feat: Add Gleam support (#8) |
Date: |
Mon, 1 Jul 2024 10:03:12 -0400 (EDT) |
branch: elpa/treesit-fold
commit eb714e2c218a23a10eaa51aae3ddbf1b5105bdc1
Author: Akira Komamura <6270544+akirak@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
feat: Add Gleam support (#8)
---
treesit-fold-parsers.el | 11 +++++++++++
treesit-fold.el | 13 +++++++++++++
2 files changed, 24 insertions(+)
diff --git a/treesit-fold-parsers.el b/treesit-fold-parsers.el
index 02bf77833a..9beea1a971 100644
--- a/treesit-fold-parsers.el
+++ b/treesit-fold-parsers.el
@@ -264,6 +264,17 @@
. (lambda (node offset)
(treesit-fold-range-line-comment node offset "#")))))
+(defun treesit-fold-parsers-gleam ()
+ "Rules set for Gleam."
+ '((function . treesit-fold-range-gleam)
+ (type_definition . treesit-fold-range-gleam)
+ (module_comment
+ . (lambda (node offset)
+ (treesit-fold-range-line-comment node offset "////")))
+ (statement_comment
+ . (lambda (node offset)
+ (treesit-fold-range-line-comment node offset "///")))))
+
(defun treesit-fold-parsers-glsl ()
"Rule set for GLSL."
'((field_declaration_list . treesit-fold-range-seq)
diff --git a/treesit-fold.el b/treesit-fold.el
index c75adafa61..565eb2835b 100644
--- a/treesit-fold.el
+++ b/treesit-fold.el
@@ -96,6 +96,7 @@
(fish-mode . ,(treesit-fold-parsers-fish))
(gdscript-mode . ,(treesit-fold-parsers-gdscript))
(gdscript-ts-mode . ,(treesit-fold-parsers-gdscript))
+ (gleam-ts-mode . ,(treesit-fold-parsers-gleam))
(glsl-mode . ,(treesit-fold-parsers-glsl))
(go-mode . ,(treesit-fold-parsers-go))
(go-ts-mode . ,(treesit-fold-parsers-go))
@@ -880,6 +881,18 @@ more information."
(end (1- end)))
(treesit-fold--cons-add (cons beg end) offset)))
+(defun treesit-fold-range-gleam (node offset)
+ "Return the fold range for `function' `type_definition' NODE in Gleam.
+
+For arguments NODE and OFFSET, see function `treesit-fold-range-seq' for
+more information."
+ (when-let* ((open-bracket (car (treesit-fold-find-children node "{")))
+ (beg (treesit-node-start open-bracket))
+ (beg (1+ beg))
+ (end (treesit-node-end node))
+ (end (1- end)))
+ (treesit-fold--cons-add (cons beg end) offset)))
+
(defun treesit-fold-range-groovy-block (node offset)
"Define fold range for `block' in Groovy.
- [nongnu] elpa/treesit-fold 54d12c9822 281/417: feat: Add TOML support (#68), (continued)
- [nongnu] elpa/treesit-fold 54d12c9822 281/417: feat: Add TOML support (#68), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b1021c2acb 293/417: feat: Add Noir support (#77), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold fe3e7610b1 403/417: fix: `treesit-fold-close-all` raises an wrong type error (#5), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 993db0aa02 383/417: feat: Enhance SQL folding, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 0b48d9b286 355/417: reordered the alists for alphabetical ordering, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 27c0fd0c7e 361/417: style: Place functions in alphabetic order, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e36498c9e1 323/417: docs: Apply new changes from line-reminder, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a6c75c8373 334/417: Bump version, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e704add10d 340/417: fix(llvm): Fix folding for LLVM's label, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 41c13ff0e2 416/417: 2 bug fix (#10), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold eb714e2c21 408/417: feat: Add Gleam support (#8),
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 14e3f13f67 415/417: feat: Enhance the Gleam support (#9), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7833eb31ab 096/417: Function void, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold ad0e036355 099/417: Core, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 862b571191 118/417: Remove def, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 44714c252a 126/417: Quote description, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a1b5e97fa0 132/417: Improve doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 49aff53680 136/417: Add comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5e956f74dc 148/417: Support python comment and document string, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 68c7954b3a 155/417: Apply more accurate c-like comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b2222f0f7f 159/417: Update list, ELPA Syncer, 2024/07/01