Unnamed repository; edit this file 'description' to name the repository.
feat: add a tree-sitter grammar for hdl (#14140)
quantonganh 7 months ago
parent 178c557 · commit 43990ed
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml11
-rw-r--r--runtime/queries/hdl/highlights.scm28
3 files changed, 40 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 17f01222..5adc31a6 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -100,6 +100,7 @@
| haskell | ✓ | ✓ | | | | `haskell-language-server-wrapper` |
| haskell-persistent | ✓ | | | | | |
| hcl | ✓ | ✓ | ✓ | | | `terraform-ls` |
+| hdl | ✓ | | | | | |
| heex | ✓ | ✓ | | | | `elixir-ls` |
| helm | ✓ | | | | | `helm_ls` |
| hocon | ✓ | ✓ | ✓ | | | |
diff --git a/languages.toml b/languages.toml
index 84a39ebd..ac02ff8c 100644
--- a/languages.toml
+++ b/languages.toml
@@ -3351,6 +3351,17 @@ name = "smithy"
source = { git = "https://github.com/indoorvivants/tree-sitter-smithy", rev = "8327eb84d55639ffbe08c9dc82da7fff72a1ad07" }
[[language]]
+name = "hdl"
+scope = "source.hdl"
+file-types = ["hdl"]
+indent = { tab-width = 4, unit = " " }
+injection-regex = "hdl"
+
+[[grammar]]
+name = "hdl"
+source = { git = "https://github.com/quantonganh/tree-sitter-hdl", rev = "7d0418fd71470b0430e6f914cc76c1a9d968491d" }
+
+[[language]]
name = "vhdl"
scope = "source.vhdl"
file-types = ["vhd", "vhdl"]
diff --git a/runtime/queries/hdl/highlights.scm b/runtime/queries/hdl/highlights.scm
new file mode 100644
index 00000000..17d1a049
--- /dev/null
+++ b/runtime/queries/hdl/highlights.scm
@@ -0,0 +1,28 @@
+;; Keywords
+[
+ "CHIP"
+ "IN"
+ "OUT"
+ "PARTS"
+] @keyword
+
+(identifier) @variable
+
+(chip_definition
+ name: (identifier) @function)
+
+(in_section
+ input_pin_name: (identifier) @variable.parameter)
+
+(out_section
+ output_pin_name: (identifier) @variable.parameter)
+
+(part
+ chip_name: (identifier) @function)
+
+(connection
+ part_pin: (identifier) @variable.other.member
+ chip_pin: (identifier) @variable.parameter)
+
+;; Comments
+(comment) @comment