Skip to content

Commit

Permalink
Use tree-sitter-ruby for crystal (helix-editor#5205)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis authored and Shafkath Shuhan committed Jan 24, 2023
1 parent 05aa1c0 commit 342f213
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 71 deletions.
2 changes: 1 addition & 1 deletion book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
| common-lisp || | | `cl-lsp` |
| cpon || || |
| cpp |||| `clangd` |
| crystal || | | |
| crystal || | | |
| css || | | `vscode-css-language-server` |
| cue || | | `cuelsp` |
| d |||| `serve-d` |
Expand Down
5 changes: 1 addition & 4 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,7 @@ file-types = ["cr"]
roots = ["shard.yml", "shard.lock"]
comment-token = "#"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "crystal"
source = { git = "https://github.com/will/tree-sitter-crystal", rev = "15597b307b18028b04d288561f9c29794621562b" }
grammar = "ruby"

[[language]]
name = "c-sharp"
Expand Down
67 changes: 1 addition & 66 deletions runtime/queries/crystal/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,66 +1 @@
[
"class"
"struct"
"module"

"def"
"alias"
"do"
"end"

"require"
"include"
"extend"
] @keyword

[
"[" "]"
"(" ")"
"{" "}"
] @punctuation.bracket

(operator) @operator

(comment) @comment

; literals

(nil) @constant.builtin
(bool) @constant.builtin.boolean

(integer) @constant.numeric.integer
(float) @constant.numeric.float

[
(string)
(char)
(commandLiteral)
] @string

(symbol) @string.special.symbol

(regex) @string.special.regex

; variables

(local_variable) @variable

[
(instance_variable)
(class_variable)
] @variable.other.member

(constant) @constant

; type defintitions

(type_identifier) @constructor

; method definition/call
(identifier) @function.method

; types
(generic_type) @type
(union_type) @type
(type_identifier) @type

; inherits: ruby
1 change: 1 addition & 0 deletions runtime/queries/crystal/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: ruby
1 change: 1 addition & 0 deletions runtime/queries/crystal/locals.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: ruby
1 change: 1 addition & 0 deletions runtime/queries/crystal/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: ruby

0 comments on commit 342f213

Please sign in to comment.