Skip to content

Commit

Permalink
Crystal language support (helix-editor#4993)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jomy10 authored and Frederik Vestre committed Feb 6, 2023
1 parent e14bca4 commit 9588d10
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
| common-lisp || | | `cl-lsp` |
| cpon || || |
| cpp |||| `clangd` |
| crystal || | | |
| css || | | `vscode-css-language-server` |
| cue || | | `cuelsp` |
| d |||| `serve-d` |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,18 @@ args = { console = "internalConsole", attachCommands = [ "platform select remote
name = "cpp"
source = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "d5e90fba898f320db48d81ddedd78d52c67c1fed" }

[[language]]
name = "crystal"
scope = "source.cr"
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" }

[[language]]
name = "c-sharp"
scope = "source.csharp"
Expand Down
66 changes: 66 additions & 0 deletions runtime/queries/crystal/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
"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

0 comments on commit 9588d10

Please sign in to comment.