[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold a70c9ab017 327/417: feat: Add Groovy support
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold a70c9ab017 327/417: feat: Add Groovy support (#98) |
Date: |
Mon, 1 Jul 2024 10:02:59 -0400 (EDT) |
branch: elpa/treesit-fold
commit a70c9ab017bb3b7fef6dd1f829d25a726f6846f0
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>
feat: Add Groovy support (#98)
---
CHANGELOG.md | 1 +
README.md | 2 +-
ts-fold-parsers.el | 6 ++++++
ts-fold-summary.el | 2 ++
ts-fold.el | 14 ++++++++++++++
5 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16c7511d61..b378811a23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for
recommendations on how
* Add `Fish` support (#96)
* perf: Render indicators in display range (#97)
* fix: Don't render indicators on non-foldable node
(342eb5ee1f242ac03bc7e7bbe8d67be8711423ae)
+* Add `Groovy` and `Jenkinsfile` support (#98)
## 0.2.0
> Released Sep 01, 2023
diff --git a/README.md b/README.md
index 003f4c5b41..9fce1ab4ef 100644
--- a/README.md
+++ b/README.md
@@ -118,7 +118,7 @@ These languages are fairly complete:
- Dart
- Elisp / Elixir / Erlang
- Fish
-- GDScript / GLSL / Go
+- GDScript / GLSL / Go / Groovy (Jenkinsfile)
- Haskell / HLSL / HTML
- Jai / Java / JavaScript / JSX / JSON / Jsonnet / Julia
- Kotlin
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 3ae5b4961a..898d0b8d4e 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -246,6 +246,12 @@
(interface_type . (lambda (node offset)
(ts-fold-range-markers node offset "{" "}")))))
+(defun ts-fold-parsers-groovy ()
+ "Rule set for Groovy."
+ '((block . ts-fold-range-groovy-block)
+ (line_comment . ts-fold-range-c-like-comment)
+ (block_comment . ts-fold-range-c-like-comment)))
+
(defun ts-fold-parsers-haskell ()
"Rule set for Haskell."
'((function . ts-fold-range-haskell-function)
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 193d30a542..9fd860e1db 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -238,6 +238,8 @@ type of content by checking the word boundary's existence."
(gdscript-mode . ts-fold-summary-ruby-doc)
(glsl-mode . ts-fold-summary-c)
(go-mode . ts-fold-summary-go)
+ (groovy-mode . ts-fold-summary-javadoc)
+ (jenkinsfile-mode . ts-fold-summary-javadoc)
(haskell-mode . ts-fold-summary-lua-doc)
(hlsl-mode . ts-fold-summary-c)
(html-mode . ts-fold-summary-xml)
diff --git a/ts-fold.el b/ts-fold.el
index e5b31a4351..3cc3ae8eac 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -81,6 +81,8 @@
(gdscript-mode . ,(ts-fold-parsers-gdscript))
(glsl-mode . ,(ts-fold-parsers-glsl))
(go-mode . ,(ts-fold-parsers-go))
+ (groovy-mode . ,(ts-fold-parsers-groovy))
+ (jenkinsfile-mode . ,(ts-fold-parsers-groovy))
(haskell-mode . ,(ts-fold-parsers-haskell))
(hlsl-mode . ,(ts-fold-parsers-hlsl))
(html-mode . ,(ts-fold-parsers-html))
@@ -726,6 +728,18 @@ more information."
(end (1- end)))
(ts-fold--cons-add (cons beg end) offset)))
+(defun ts-fold-range-groovy-block (node offset)
+ "Define fold range for `block' in Groovy.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((open-bracket (car (ts-fold-find-children node "{")))
+ (beg (tsc-node-start-position open-bracket))
+ (beg (1+ beg))
+ (end (tsc-node-end-position node))
+ (end (1- end)))
+ (ts-fold--cons-add (cons beg end) offset)))
+
(defun ts-fold-range-haskell-function (node offset)
"Define fold range for `function' in Haskell.
- [nongnu] elpa/treesit-fold 27c6bc4819 265/417: feature(parser): Add support for python docstring (#58), (continued)
- [nongnu] elpa/treesit-fold 27c6bc4819 265/417: feature(parser): Add support for python docstring (#58), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 663dcac0a9 301/417: chore(deps): bump actions/checkout from 3 to 4 (#84), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 704a0463ed 357/417: fixed merge conflict, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 46fdb65c77 395/417: feat: Add hook after indicator refresh, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a39f3bbe48 117/417: WIP for C preprocessor, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold af2679860f 129/417: Def prog, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e334470a17 203/417: update, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7667a37644 268/417: fix(indicators): Warning 'when' with empty body, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b19f6f54bf 371/417: feat: Add Haxe support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold de6d9ae174 255/417: docs(README.md): Improve instruction for line-reminder, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a70c9ab017 327/417: feat: Add Groovy support (#98),
ELPA Syncer <=