Skip to content

Commit

Permalink
Merge pull request #1 from nicklatch/main
Browse files Browse the repository at this point in the history
Add LSP support and tree-sitter queries
  • Loading branch information
nobodywasishere authored Sep 18, 2024
2 parents f0c46ec + 9593eda commit 405cb76
Show file tree
Hide file tree
Showing 14 changed files with 656 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/grammars
target
*.wasm
329 changes: 329 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "zed_crystal"
version = "0.0.1"
edition = "2021"
publish = false

[lib]
path = "src/crystal.rs"
crate-type = ["cdylib"]

[dependencies]
zed_extension_api = "0.1.0"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ This is very much a work in progress as the tree-sitter is developed. Utilizes t

Dev installation:
- Clone the repository, rename the folder to `crystal`
- Install [crystalline](https://github.com/elbywan/crystalline/releases/tag/v0.14.1) and make sure it is on `$PATH`
- In Zed, install a dev extension with Cmd+Shift+P > `install dev extension`
17 changes: 13 additions & 4 deletions extension.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
authors = ["Margret Riegert <[email protected]>"]
description = "Syntax highlighting for Crystal"
description = "Syntax highlighting and LSP support for Crystal"
id = "crystal"
name = "Crystal"
repository = "https://github.com/crystal-lang-tools/zed-crystal"
schema_version = 1
version = "0.0.1"

[grammars.crystal]
commit = "61cc201c8eb3b6fd4d4eb3e0ac6c303a580eeb6b"
repository = "https://github.com/crystal-lang-tools/tree-sitter"
# Use Ruby grammar for now until Crystal grammar is more complete
[grammars.ruby]
repository = "https://github.com/tree-sitter/tree-sitter-ruby"
commit = "7dbc1e2d0e2d752577655881f73b4573f3fe85d4"

[language_servers.crystalline]
name = "crystalline"
language = "Crystal"

# [grammars.crystal]
# commit = "61cc201c8eb3b6fd4d4eb3e0ac6c303a580eeb6b"
# repository = "https://github.com/crystal-lang-tools/tree-sitter"
14 changes: 14 additions & 0 deletions languages/crystal/brackets.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
("[" @open "]" @close)
("{" @open "}" @close)
("\"" @open "\"" @close)
("do" @open "end" @close)

(block_parameters "|" @open "|" @close)
(interpolation "#{" @open "}" @close)

(if "if" @open "end" @close)
(unless "unless" @open "end" @close)
(begin "begin" @open "end" @close)
(module "module" @open "end" @close)
(_ . "def" @open "end" @close)
(_ . "class" @open "end" @close)
Loading

0 comments on commit 405cb76

Please sign in to comment.