Update Crystal tree sitter and add support for ameba-ls (#13805)

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
pull/13708/head^2
Margret Riegert 2025-06-21 13:02:16 -04:00 committed by GitHub
parent 4a85171907
commit c96642125f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 400 additions and 7 deletions

View File

@ -30,7 +30,7 @@
| common-lisp | ✓ | | ✓ | `cl-lsp` | | common-lisp | ✓ | | ✓ | `cl-lsp` |
| cpon | ✓ | | ✓ | | | cpon | ✓ | | ✓ | |
| cpp | ✓ | ✓ | ✓ | `clangd` | | cpp | ✓ | ✓ | ✓ | `clangd` |
| crystal | ✓ | ✓ | | `crystalline` | | crystal | ✓ | ✓ | | `crystalline`, `ameba-ls` |
| css | ✓ | | ✓ | `vscode-css-language-server` | | css | ✓ | | ✓ | `vscode-css-language-server` |
| csv | ✓ | | | | | csv | ✓ | | | |
| cue | ✓ | | | `cuelsp` | | cue | ✓ | | | `cuelsp` |

View File

@ -9,6 +9,7 @@ ada-gpr-language-server = {command = "ada_language_server", args = ["--language-
ada-language-server = { command = "ada_language_server" } ada-language-server = { command = "ada_language_server" }
als = { command = "als" } als = { command = "als" }
amber-lsp = { command = "amber-lsp" } amber-lsp = { command = "amber-lsp" }
ameba-ls = { command = "ameba-ls" }
angular = {command = "ngserver", args = ["--stdio", "--tsProbeLocations", ".", "--ngProbeLocations", ".",]} angular = {command = "ngserver", args = ["--stdio", "--tsProbeLocations", ".", "--ngProbeLocations", ".",]}
asm-lsp = { command = "asm-lsp" } asm-lsp = { command = "asm-lsp" }
awk-language-server = { command = "awk-language-server" } awk-language-server = { command = "awk-language-server" }
@ -647,10 +648,13 @@ file-types = ["cr"]
roots = ["shard.yml", "shard.lock"] roots = ["shard.yml", "shard.lock"]
comment-token = "#" comment-token = "#"
indent = { tab-width = 2, unit = " " } indent = { tab-width = 2, unit = " " }
grammar = "ruby" language-servers = [ "crystalline", "ameba-ls" ]
language-servers = [ "crystalline" ]
formatter = { command = "crystal", args = ["tool", "format", "-"] } formatter = { command = "crystal", args = ["tool", "format", "-"] }
[[grammar]]
name = "crystal"
source = { git = "https://github.com/crystal-lang-tools/tree-sitter-crystal", rev = "76afc1f53518a2b68b51a5abcde01d268a9cb47c" }
[[language]] [[language]]
name = "c-sharp" name = "c-sharp"
scope = "source.csharp" scope = "source.csharp"

View File

@ -1 +1,300 @@
; inherits: ruby [
","
";"
"."
":"
"*"
"**"
] @punctuation.delimiter
[
"alias"
"alignof"
"annotation"
"asm"
"begin"
"case"
"def"
"do"
"end"
"extend"
"forall"
"fun"
"in"
"include"
"instance_alignof"
"instance_sizeof"
"macro"
"of"
"offsetof"
"out"
"pointerof"
"select"
"sizeof"
"then"
"type"
"typeof"
"uninitialized"
"verbatim"
"when"
"with"
] @keyword
[
"else"
"elsif"
"if"
"unless"
] @keyword.control.conditional
[
"for"
"until"
"while"
] @keyword.control.repeat
["require"] @keyword.control.import
[
"break"
"next"
"return"
"yield"
] @keyword.control.return
[
"ensure"
"rescue"
] @keyword.control.exception
[
"class"
"enum"
"lib"
"module"
"struct"
"union"
] @keyword.storage.type
(conditional
[
"?"
":"
] @keyword.control.conditional)
[
(private)
(protected)
"abstract"
] @keyword
(pseudo_constant) @constant.builtin
; literals
(char
["'" (literal_content)] @string)
(char
(escape_sequence) @constant.character.escape)
(string
["\"" (literal_content)] @string)
(string
(escape_sequence) @constant.character.escape)
(symbol
[
":"
":\""
"\""
(literal_content)
] @string.special.symbol)
(symbol
(escape_sequence) @constant.character.escape)
(command
["`" (literal_content)] @string.special)
(command
(escape_sequence) @constant.character.escape)
(regex
"/" @punctuation.bracket)
(regex
(literal_content) @string.regexp)
(regex_modifier) @string.special.symbol
(heredoc_body
(literal_content) @string)
(heredoc_body
(escape_sequence) @constant.character.escape)
[
(heredoc_start)
(heredoc_end)
] @string.symbol
(integer) @constant.numeric.integer
(float) @constant.numeric.float
[
(true)
(false)
(nil)
(self)
] @variable.builtin
(
(comment)+ @comment.block.documentation
.
[
(class_def)
(struct_def)
(method_def)
(abstract_method_def)
(macro_def)
(module_def)
(enum_def)
(annotation_def)
(lib_def)
(type_def)
(c_struct_def)
(union_def)
(alias)
(const_assign)
]
)
(comment) @comment
; Operators and punctuation
[
"="
"=>"
"->"
"&"
(operator)
] @operator
[
"("
")"
"["
"@["
"]"
"{"
"}"
] @punctuation.bracket
(index_call
method: (operator) @punctuation.bracket
[
"]"
"]?"
] @punctuation.bracket)
(block
"|" @punctuation.bracket)
[
"{%"
"%}"
"{{"
"}}"
] @keyword.directive
(interpolation
"#{" @punctuation.special
"}" @punctuation.special)
; TODO: {splat,double_splat,block,fun}_param + rescue param
; Types
(nilable_constant
"?" @type)
(nilable_type
"?" @type)
(union_type
"|" @operator)
(annotation
(constant) @attribute)
(identifier) @variable
(param name: (identifier) @variable.parameter)
(method_def
name: (identifier) @function.method)
(macro_def
name: (identifier) @function.method)
(abstract_method_def
name: (identifier) @function.method)
(fun_def
name: (identifier) @function.method
real_name: (identifier)? @function.method)
(macro_var) @variable
[
(class_var)
(instance_var)
] @variable.other.member
(named_expr
name: (identifier) @variable.other.member
":" @variable.other.member)
(named_type
name: (identifier) @variable.other.member)
(underscore) @variable.special
; function calls
(call
method: (_) @keyword
arguments: (argument_list
[
(type_declaration
var: (_) @function.method)
(assign
lhs: (_) @function.method)
(_) @function.method
])
(#match? @keyword "^(class_)?(getter|setter|property)[?!]?$"))
(call
method: (_) @keyword
(#match? @keyword "^(record|is_a\\?|as|as\\?|responds_to\\?|nil\\?|\\!)$"))
(call
method: (_) @function.method)
(implicit_object_call
method: (_) @function.method)
(method_proc
method: (_) @function.method)
(assign_call
method: (_) @function.method)
((identifier) @variable.builtin
(#match? @variable.builtin "^(previous_def|super)$"))
[
(constant)
(generic_instance_type)
(generic_type)
] @type

View File

@ -0,0 +1,29 @@
[
(param_list)
(array)
(block)
(call)
(class_def)
(struct_def)
(module_def)
(enum_def)
(lib_def)
(fun_def)
(method_def)
(case)
(select)
(elsif)
(if)
(unless)
(hash)
(tuple)
] @indent
[
")"
"}"
"]"
"end"
"when"
"in"
] @outdent

View File

@ -1 +1,11 @@
; inherits: ruby ((heredoc_body
(literal_content) @injection.content
(heredoc_end) @name
(#set! injection.language "sql"))
(#eq? @name "SQL"))
((heredoc_body
(literal_content) @injection.content
(heredoc_end) @name
(#set! injection.language "html"))
(#eq? @name "HTML"))

View File

@ -1 +1,14 @@
; inherits: ruby ((method_def) @local.scope
(#set! local.scope-inherits false))
((fun_def) @local.scope
(#set! local.scope-inherits false))
(block) @local.scope
(param
name: (identifier) @local.definition.variable.parameter)
(assign
lhs: (identifier) @local.definition.variable)
(identifier) @local.reference

View File

@ -0,0 +1 @@
;;

View File

@ -1 +1,38 @@
; inherits: ruby (class_def
name: (_)
(_) @class.inside) @class.around
(struct_def
name: (_)
(_) @class.inside) @class.around
(module_def
name: (_)
(_) @class.inside) @class.around
(lib_def
name: (_)
(_) @class.inside) @class.around
(enum_def
name: (_)
(_) @class.inside) @class.around
(block
params: (_) @parameter.inside) @parameter.around
(method_def
params: (_) @parameter.inside) @parameter.around
(method_def
name: (_)
(_) @function.inside) @function.around
(block
(_) @function.inside) @function.around
(comment) @comment.inside
(comment)+ @comment.around
(array
(_) @entry.around)