From b368df57855c77be5f3ae6601f5a83b586feb7c3 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 8 Jan 2023 12:12:04 -0500 Subject: [PATCH] Use tree-sitter-ruby for crystal (#5205) --- book/src/generated/lang-support.md | 2 +- languages.toml | 5 +- runtime/queries/crystal/highlights.scm | 67 +------------------------ runtime/queries/crystal/injections.scm | 1 + runtime/queries/crystal/locals.scm | 1 + runtime/queries/crystal/textobjects.scm | 1 + 6 files changed, 6 insertions(+), 71 deletions(-) create mode 100644 runtime/queries/crystal/injections.scm create mode 100644 runtime/queries/crystal/locals.scm create mode 100644 runtime/queries/crystal/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index babb9941..a21d9da9 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -16,7 +16,7 @@ | common-lisp | ✓ | | | `cl-lsp` | | cpon | ✓ | | ✓ | | | cpp | ✓ | ✓ | ✓ | `clangd` | -| crystal | ✓ | | | | +| crystal | ✓ | ✓ | | | | css | ✓ | | | `vscode-css-language-server` | | cue | ✓ | | | `cuelsp` | | d | ✓ | ✓ | ✓ | `serve-d` | diff --git a/languages.toml b/languages.toml index 5f16d17b..3ade3ea9 100644 --- a/languages.toml +++ b/languages.toml @@ -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" diff --git a/runtime/queries/crystal/highlights.scm b/runtime/queries/crystal/highlights.scm index 33a53e7f..57154286 100644 --- a/runtime/queries/crystal/highlights.scm +++ b/runtime/queries/crystal/highlights.scm @@ -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 diff --git a/runtime/queries/crystal/injections.scm b/runtime/queries/crystal/injections.scm new file mode 100644 index 00000000..57154286 --- /dev/null +++ b/runtime/queries/crystal/injections.scm @@ -0,0 +1 @@ +; inherits: ruby diff --git a/runtime/queries/crystal/locals.scm b/runtime/queries/crystal/locals.scm new file mode 100644 index 00000000..57154286 --- /dev/null +++ b/runtime/queries/crystal/locals.scm @@ -0,0 +1 @@ +; inherits: ruby diff --git a/runtime/queries/crystal/textobjects.scm b/runtime/queries/crystal/textobjects.scm new file mode 100644 index 00000000..57154286 --- /dev/null +++ b/runtime/queries/crystal/textobjects.scm @@ -0,0 +1 @@ +; inherits: ruby