[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold cd7963038f 318/417: feat: Add Fish support (#
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold cd7963038f 318/417: feat: Add Fish support (#96) |
Date: |
Mon, 1 Jul 2024 10:02:58 -0400 (EDT) |
branch: elpa/treesit-fold
commit cd7963038f7c3ec95d25b0088ff56ec64f416ce5
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>
feat: Add Fish support (#96)
* feat: Add Fish support
* complete
---
CHANGELOG.md | 1 +
README.md | 1 +
ts-fold-parsers.el | 15 +++++++++++++++
ts-fold-summary.el | 1 +
ts-fold.el | 38 ++++++++++++++++++++++++++++++++++++++
5 files changed, 56 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f71b2dff2d..ac45833d17 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for
recommendations on how
* Add `HLSL` support (#93)
* Add `GLSL` support (#94)
* Add `Arduino` support (#95)
+* Add `Fish` support (#96)
## 0.2.0
> Released Sep 01, 2023
diff --git a/README.md b/README.md
index 575e878da9..e73c1f60b4 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,7 @@ These languages are fairly complete:
- C / C++ / C# / Clojure / CMake / CSS
- Dart
- Elisp / Elixir / Erlang
+- Fish
- GDScript / GLSL / Go
- Haskell / HLSL / HTML
- Jai / Java / JavaScript / JSX / JSON / Jsonnet / Julia
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index 0448b0a7e6..3ae5b4961a 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -50,6 +50,9 @@
(declare-function ts-fold-range-elixir "ts-fold.el")
(declare-function ts-fold-range-erlang-clause-body "ts-fold.el")
(declare-function ts-fold-range-erlang-type-guards "ts-fold.el")
+(declare-function ts-fold-range-fish-function "ts-fold.el")
+(declare-function ts-fold-range-fish-if "ts-fold.el")
+(declare-function ts-fold-range-fish-case "ts-fold.el")
(declare-function ts-fold-range-haskell-function "ts-fold.el")
(declare-function ts-fold-range-html "ts-fold.el")
(declare-function ts-fold-range-julia "ts-fold.el")
@@ -207,6 +210,18 @@
. (lambda (node offset)
(ts-fold-range-line-comment node offset "%")))))
+(defun ts-fold-parsers-fish ()
+ "Rules set for Fish."
+ '((function_definition . ts-fold-range-fish-function)
+ (if_statement . ts-fold-range-fish-if)
+ (switch_statement . ts-fold-range-fish-if)
+ (for_statement . ts-fold-range-fish-if)
+ (while_statement . ts-fold-range-fish-if)
+ (case_clause . ts-fold-range-fish-case)
+ (comment
+ . (lambda (node offset)
+ (ts-fold-range-line-comment node offset "#")))))
+
(defun ts-fold-parsers-gdscript ()
"Rule set for GGScript."
'((body . (ts-fold-range-seq -1 1))
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 5d314e3cfe..193d30a542 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -234,6 +234,7 @@ type of content by checking the word boundary's existence."
(emacs-lisp-mode . ts-fold-summary-elisp)
(elixir-mode . ts-fold-summary-ruby-doc)
(erlang-mode . ts-fold-summary-tex-doc)
+ (fish-mode . ts-fold-summary-javadoc)
(gdscript-mode . ts-fold-summary-ruby-doc)
(glsl-mode . ts-fold-summary-c)
(go-mode . ts-fold-summary-go)
diff --git a/ts-fold.el b/ts-fold.el
index e75ab1c3e4..e1527e7565 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -77,6 +77,7 @@
(elixir-mode . ,(ts-fold-parsers-elixir))
(erlang-mode . ,(ts-fold-parsers-erlang))
(ess-r-mode . ,(ts-fold-parsers-r))
+ (fish-mode . ,(ts-fold-parsers-fish))
(gdscript-mode . ,(ts-fold-parsers-gdscript))
(glsl-mode . ,(ts-fold-parsers-glsl))
(go-mode . ,(ts-fold-parsers-go))
@@ -692,6 +693,43 @@ For arguments NODE and OFFSET, see function
`ts-fold-range-seq' for
more information."
(ts-fold-range-erlang-signature node offset "when"))
+(defun ts-fold-range-fish-function (node offset)
+ "Define fold range for `function' in Fish.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((func-name (tsc-get-nth-child node 1))
+ (beg (tsc-node-end-position func-name))
+ (end (tsc-node-end-position node))
+ (end (- end 3)))
+ (when ts-fold-on-next-line ; display nicely
+ (setq end (ts-fold--last-eol end)))
+ (ts-fold--cons-add (cons beg end) offset)))
+
+(defun ts-fold-range-fish-if (node offset)
+ "Define fold range for `if_statement' in Fish.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((beg (tsc-node-start-position node))
+ (beg (ts-fold--eol beg))
+ (end (tsc-node-end-position node))
+ (end (- end 3)))
+ (when ts-fold-on-next-line ; display nicely
+ (setq end (ts-fold--last-eol end)))
+ (ts-fold--cons-add (cons beg end) offset)))
+
+(defun ts-fold-range-fish-case (node offset)
+ "Define fold range for `case_clause' in Fish.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((beg (tsc-node-start-position node))
+ (beg (ts-fold--eol 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 aafc4c0a5f 373/417: Changelog, (continued)
- [nongnu] elpa/treesit-fold aafc4c0a5f 373/417: Changelog, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 47c58282f7 335/417: Release, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9cbc292502 394/417: fix: Use handle dependent, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c7a9d62e4c 363/417: feat: Add Ninja support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2236641e53 397/417: chore: changelog, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f2650076af 382/417: fix: Clean compile warngins, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 882c4faae8 271/417: fix(parsers): update nix definitions (#37), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold bb5bd2e31e 276/417: feat: Add Clojure support (#64), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold dcf6fdcb85 292/417: Bump version for next version, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b52b33357e 300/417: feat: Add Erlang support (#83), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold cd7963038f 318/417: feat: Add Fish support (#96),
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 8972eb674e 391/417: feat: Fully support isearch and modification conditions (#1), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 3dd7c477fb 305/417: feat: Add CMake support (#86), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 250567abd2 345/417: Register qss-mode with CSS, ELPA Syncer, 2024/07/01
- [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