[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold 7a7bd70185 295/417: feat: Add VHDL support (#
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold 7a7bd70185 295/417: feat: Add VHDL support (#79) |
Date: |
Mon, 1 Jul 2024 10:02:37 -0400 (EDT) |
branch: elpa/treesit-fold
commit 7a7bd701850438768504aed1ff48d1d2b266cd74
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>
feat: Add VHDL support (#79)
* feat: Add VHDL support
* fix ext
---
CHANGELOG.md | 1 +
README.md | 2 +-
ts-fold-parsers.el | 9 +++++++++
ts-fold-summary.el | 1 +
ts-fold.el | 29 +++++++++++++++++++++++++++++
5 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3bbfbe5f0..0dec1f9837 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for
recommendations on how
* Add Noir support (#77)
* Improve Elixir UX (#78)
+* Add VHDL support (#79)
## 0.2.0
> Released Sep 01, 2023
diff --git a/README.md b/README.md
index 95056e670f..22c8ee762c 100644
--- a/README.md
+++ b/README.md
@@ -127,7 +127,7 @@ These languages are fairly complete:
- R / Ruby / Rust
- Scala / Scheme / Swift
- TOML / TypeScript / TSX
-- Verilog
+- Verilog / VHDL
- YAML
These languages are in development:
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index bf862327d4..148fb4312f 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -68,6 +68,8 @@
(declare-function ts-fold-range-toml-table "ts-fold.el")
(declare-function ts-fold-range-verilog-list "ts-fold.el")
(declare-function ts-fold-range-verilog-module "ts-fold.el")
+(declare-function ts-fold-range-vhdl-package "ts-fold.el")
+(declare-function ts-fold-range-vhdl-type "ts-fold.el")
;;
;; (@* "Parsers" )
@@ -410,6 +412,13 @@
(initial_construct . ts-fold-range-initial-construct)
(comment . ts-fold-range-c-like-comment)))
+(defun ts-fold-parsers-vhdl ()
+ "Rule set for VHDL."
+ '((package_declaration . ts-fold-range-vhdl-package)
+ (full_type_declaration . ts-fold-range-vhdl-type)
+ (enumeration_type_definition . ts-fold-range-seq)
+ (comment . ts-fold-range-lua-comment)))
+
(defun ts-fold-parsers-yaml ()
"Rule set for YAML."
'((comment
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index 705eb29256..dc5e6ab552 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -251,6 +251,7 @@ type of content by checking the word boundary's existence."
(conf-toml-mode . ts-fold-summary-javadoc)
(typescript-mode . ts-fold-summary-javadoc)
(verilog-mode . ts-fold-summary-javadoc)
+ (vhdl-mode . ts-fold-summary-lua-doc)
(nxml-mode . ts-fold-summary-xml))
"Alist mapping `major-mode' to doc parser function."
:type '(alist :key-type symbol :value-type function)
diff --git a/ts-fold.el b/ts-fold.el
index 80a7ed689b..e39fc3b8d6 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -107,6 +107,7 @@
(tuareg-mode . ,(ts-fold-parsers-ocaml))
(typescript-mode . ,(ts-fold-parsers-typescript))
(verilog-mode . ,(ts-fold-parsers-verilog))
+ (vhdl-mode . ,(ts-fold-parsers-vhdl))
(yaml-mode . ,(ts-fold-parsers-yaml)))
"An alist of (major-mode . (foldable-node-type . function)).
@@ -906,5 +907,33 @@ more information."
(setq end (ts-fold--last-eol end)))
(ts-fold--cons-add (cons beg end) offset)))
+(defun ts-fold-range-vhdl-package (node offset)
+ "Return the fold range for `package' NODE in VHDL.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((start-child (car (ts-fold-find-children node
"declarative_part")))
+ (beg (tsc-node-start-position start-child))
+ (beg (ts-fold--last-eol beg))
+ (end-child (car (ts-fold-find-children node "end")))
+ (end (tsc-node-start-position end-child)))
+ (when ts-fold-on-next-line
+ (setq end (ts-fold--last-eol end)))
+ (ts-fold--cons-add (cons beg end) offset)))
+
+(defun ts-fold-range-vhdl-type (node offset)
+ "Return the fold range for `type' NODE in VHDL.
+
+For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
+more information."
+ (when-let* ((start-child (car (ts-fold-find-children node
"record_type_definition")))
+ (record (car (ts-fold-find-children start-child "record")))
+ (beg (tsc-node-end-position record))
+ (end-child (car (ts-fold-find-children start-child "end")))
+ (end (tsc-node-start-position end-child)))
+ (when ts-fold-on-next-line
+ (setq end (ts-fold--last-eol end)))
+ (ts-fold--cons-add (cons beg end) offset)))
+
(provide 'ts-fold)
;;; ts-fold.el ends here
- [nongnu] elpa/treesit-fold 3e1a96dad0 241/417: Remove redundant fold node alist (#36), (continued)
- [nongnu] elpa/treesit-fold 3e1a96dad0 241/417: Remove redundant fold node alist (#36), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2970338c7f 273/417: docs(README.md): Add Dart support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold fe64d0e9d1 274/417: fix: Fold class in Dart, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 8734a2e2a8 288/417: feat: Add Beancount support (#74), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c515c18e84 388/417: feat: Fold script and style tag, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b5664b1c1c 306/417: feat: Add Assembly support (#87), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a860af5c66 302/417: feat(ts): Include more rules for TS, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 58adaef135 328/417: Support k8s-mode, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e82256dd27 393/417: fix: missing treesit prefix, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d705c12059 299/417: feat: Add Zig support (#82), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7a7bd70185 295/417: feat: Add VHDL support (#79),
ELPA Syncer <=
- [nongnu] elpa/treesit-fold 0c13c0e4ed 374/417: ci: Bump Emacs 29.x to 3, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e015c9a3eb 297/417: feat: Add Jsonnet support (#81), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold d50f5dd2f8 398/417: feat(parser): Add token_tree to Rust, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6dda55a29a 298/417: doc: Add development languages, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold ac1461d364 338/417: feat: Add LLVM support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9f82f1e632 400/417: Support for treesit.el (#3), ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 1d8d9352a1 369/417: feat: Add Svelte support, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold c0e9bb7f3e 344/417: fix: Improve Julia rules, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 9f48ef560c 322/417: fix: render all frames, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 12ae1d0457 356/417: Added section & environment folding to latex-parser, ELPA Syncer, 2024/07/01