Skip to content

Commit 34e0f7e

Browse files
authored
Add a simple language server for HDL (nand2tetris) (#14415)
1 parent 97293c9 commit 34e0f7e

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

book/src/generated/lang-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
| haskell ||| | | | `haskell-language-server-wrapper` |
108108
| haskell-persistent || | | | | |
109109
| hcl |||| | | `terraform-ls` |
110-
| hdl || | | | | |
110+
| hdl || | | | | `hdls` |
111111
| heex ||| | | | `elixir-ls`, `expert` |
112112
| helm || | | | | `helm_ls` |
113113
| hocon |||| | | |

languages.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ glsl_analyzer = { command = "glsl_analyzer" }
5656
graphql-language-service = { command = "graphql-lsp", args = ["server", "-m", "stream"] }
5757
harper-ls = { command = "harper-ls", args = ["--stdio"] }
5858
haskell-language-server = { command = "haskell-language-server-wrapper", args = ["--lsp"] }
59+
hdls = { command = "hdls" }
5960
hyprls = { command = "hyprls" }
6061
idris2-lsp = { command = "idris2-lsp" }
6162
intelephense = { command = "intelephense", args = ["--stdio"] }
@@ -3401,10 +3402,11 @@ scope = "source.hdl"
34013402
file-types = ["hdl"]
34023403
indent = { tab-width = 4, unit = " " }
34033404
injection-regex = "hdl"
3405+
language-servers = [ "hdls" ]
34043406

34053407
[[grammar]]
34063408
name = "hdl"
3407-
source = { git = "https://github.com/quantonganh/tree-sitter-hdl", rev = "7d0418fd71470b0430e6f914cc76c1a9d968491d" }
3409+
source = { git = "https://github.com/quantonganh/tree-sitter-hdl", rev="293902330423b2cd36ab1ec4b6b967163a4ed57b" }
34083410

34093411
[[language]]
34103412
name = "vhdl"

runtime/queries/hdl/highlights.scm

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"IN"
55
"OUT"
66
"PARTS"
7+
"BUILTIN"
8+
"CLOCKED"
79
] @keyword
810

911
(identifier) @variable
@@ -17,12 +19,26 @@
1719
(out_section
1820
output_pin_name: (identifier) @variable.parameter)
1921

22+
(builtin_body
23+
chip_name: (identifier) @function)
24+
25+
(clocked_body
26+
(identifier) @variable.parameter)
27+
2028
(part
2129
chip_name: (identifier) @function)
2230

2331
(connection
2432
part_pin: (identifier) @variable.other.member
25-
chip_pin: (identifier) @variable.parameter)
33+
chip_pin: [
34+
(identifier) @variable.parameter
35+
(bus_identifier
36+
(identifier) @variable.parameter
37+
(number) @constant.numeric)
38+
])
39+
40+
(bus_identifier
41+
(number) @constant.numeric)
2642

2743
;; Comments
2844
(comment) @comment

0 commit comments

Comments
 (0)