Skip to content

Commit 405cb76

Browse files
Merge pull request #1 from nicklatch/main
Add LSP support and tree-sitter queries
2 parents f0c46ec + 9593eda commit 405cb76

File tree

14 files changed

+656
-29
lines changed

14 files changed

+656
-29
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/grammars
2+
target
3+
*.wasm

Cargo.lock

Lines changed: 329 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "zed_crystal"
3+
version = "0.0.1"
4+
edition = "2021"
5+
publish = false
6+
7+
[lib]
8+
path = "src/crystal.rs"
9+
crate-type = ["cdylib"]
10+
11+
[dependencies]
12+
zed_extension_api = "0.1.0"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ This is very much a work in progress as the tree-sitter is developed. Utilizes t
66

77
Dev installation:
88
- Clone the repository, rename the folder to `crystal`
9+
- Install [crystalline](https://github.com/elbywan/crystalline/releases/tag/v0.14.1) and make sure it is on `$PATH`
910
- In Zed, install a dev extension with Cmd+Shift+P > `install dev extension`

extension.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
authors = ["Margret Riegert <[email protected]>"]
2-
description = "Syntax highlighting for Crystal"
2+
description = "Syntax highlighting and LSP support for Crystal"
33
id = "crystal"
44
name = "Crystal"
55
repository = "https://github.com/crystal-lang-tools/zed-crystal"
66
schema_version = 1
77
version = "0.0.1"
88

9-
[grammars.crystal]
10-
commit = "61cc201c8eb3b6fd4d4eb3e0ac6c303a580eeb6b"
11-
repository = "https://github.com/crystal-lang-tools/tree-sitter"
9+
# Use Ruby grammar for now until Crystal grammar is more complete
10+
[grammars.ruby]
11+
repository = "https://github.com/tree-sitter/tree-sitter-ruby"
12+
commit = "7dbc1e2d0e2d752577655881f73b4573f3fe85d4"
13+
14+
[language_servers.crystalline]
15+
name = "crystalline"
16+
language = "Crystal"
17+
18+
# [grammars.crystal]
19+
# commit = "61cc201c8eb3b6fd4d4eb3e0ac6c303a580eeb6b"
20+
# repository = "https://github.com/crystal-lang-tools/tree-sitter"

languages/crystal/brackets.scm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
("[" @open "]" @close)
2+
("{" @open "}" @close)
3+
("\"" @open "\"" @close)
4+
("do" @open "end" @close)
5+
6+
(block_parameters "|" @open "|" @close)
7+
(interpolation "#{" @open "}" @close)
8+
9+
(if "if" @open "end" @close)
10+
(unless "unless" @open "end" @close)
11+
(begin "begin" @open "end" @close)
12+
(module "module" @open "end" @close)
13+
(_ . "def" @open "end" @close)
14+
(_ . "class" @open "end" @close)

0 commit comments

Comments
 (0)