mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-08-17 12:00:22 +03:00
feat(lang): add hare language support (#2289)
Co-authored-by: Mehdi Katranji <hello@mek.yt>
This commit is contained in:
parent
773736b03a
commit
1a3d6252b9
@ -27,6 +27,7 @@
|
||||
| gomod | ✓ | | | `gopls` |
|
||||
| gowork | ✓ | | | `gopls` |
|
||||
| graphql | ✓ | | | |
|
||||
| hare | ✓ | | ✓ | |
|
||||
| haskell | ✓ | | | `haskell-language-server-wrapper` |
|
||||
| hcl | ✓ | | ✓ | `terraform-ls` |
|
||||
| heex | ✓ | | | |
|
||||
|
@ -1249,3 +1249,16 @@ language-server = { command = "vala-language-server" }
|
||||
[[grammar]]
|
||||
name = "vala"
|
||||
source = { git = "https://github.com/vala-lang/tree-sitter-vala", rev = "c9eea93ba2ec4ec1485392db11945819779745b3" }
|
||||
|
||||
[[language]]
|
||||
name = "hare"
|
||||
scope = "source.hare"
|
||||
injection-regex = "hare"
|
||||
file-types = ["ha"]
|
||||
roots = []
|
||||
comment-token = "//"
|
||||
indent = { tab-width = 4, unit = "\t" }
|
||||
|
||||
[[grammar]]
|
||||
name = "hare"
|
||||
source = { git = "https://git.sr.ht/~ecmma/tree-sitter-hare", rev = "bc26a6a949f2e0d98b7bfc437d459b250900a165" }
|
||||
|
158
runtime/queries/hare/highlights.scm
Normal file
158
runtime/queries/hare/highlights.scm
Normal file
@ -0,0 +1,158 @@
|
||||
[
|
||||
"f32"
|
||||
"f64"
|
||||
"i16"
|
||||
"i32"
|
||||
"i64"
|
||||
"i8"
|
||||
"int"
|
||||
"rune"
|
||||
"str"
|
||||
"u16"
|
||||
"u32"
|
||||
"u64"
|
||||
"u8"
|
||||
"uint"
|
||||
"uintptr"
|
||||
"void"
|
||||
] @type
|
||||
|
||||
|
||||
[
|
||||
"else"
|
||||
"if"
|
||||
"match"
|
||||
"switch"
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
"export"
|
||||
"use"
|
||||
] @keyword.control.import
|
||||
|
||||
[
|
||||
"continue"
|
||||
"for"
|
||||
"break"
|
||||
] @keyword.control.repeat
|
||||
|
||||
"return" @keyword.control.return
|
||||
|
||||
[
|
||||
"abort"
|
||||
"assert"
|
||||
] @keyword.control.exception
|
||||
|
||||
[
|
||||
"def"
|
||||
"fn"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"alloc"
|
||||
"append"
|
||||
"as"
|
||||
"bool"
|
||||
"char"
|
||||
"const"
|
||||
"defer"
|
||||
"delete"
|
||||
"enum"
|
||||
"free"
|
||||
"is"
|
||||
"len"
|
||||
"let"
|
||||
"match"
|
||||
"nullable"
|
||||
"offset"
|
||||
"size"
|
||||
"static"
|
||||
"struct"
|
||||
"type"
|
||||
"union"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"."
|
||||
"!"
|
||||
"~"
|
||||
"?"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+"
|
||||
"-"
|
||||
"<<"
|
||||
">>"
|
||||
"::"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
"&&"
|
||||
"||"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"&="
|
||||
"|="
|
||||
"<<="
|
||||
">>="
|
||||
"^="
|
||||
"=>"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
":"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
"..." @special
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
"false"
|
||||
"null"
|
||||
"true"
|
||||
] @constant.builtin
|
||||
|
||||
(string_constant) @string
|
||||
(escape_sequence) @constant.character.escape
|
||||
(rune_constant) @string
|
||||
(integer_constant) @constant.numeric.integer
|
||||
(floating_constant) @constant.numeric.float
|
||||
|
||||
(call_expression
|
||||
(postfix_expression) @function)
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(parameter (name) @variable.parameter)
|
||||
|
||||
(field_access_expression
|
||||
selector: (name) @variable.other.member)
|
||||
(decl_attr) @special
|
||||
(fndec_attrs) @special
|
||||
|
||||
(identifier) @variable
|
||||
|
21
runtime/queries/hare/indents.scm
Normal file
21
runtime/queries/hare/indents.scm
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
(struct_union_fields)
|
||||
(expression_list)
|
||||
] @indent
|
||||
|
||||
[
|
||||
"case"
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @outdent
|
||||
|
||||
; [
|
||||
; "{"
|
||||
; "}"
|
||||
; ] @branch
|
||||
|
||||
; [
|
||||
; (comment)
|
||||
; ] @ignore
|
||||
|
20
runtime/queries/hare/locals.scm
Normal file
20
runtime/queries/hare/locals.scm
Normal file
@ -0,0 +1,20 @@
|
||||
(unit) @local.scope
|
||||
|
||||
(function_declaration) @local.scope
|
||||
|
||||
(global_binding
|
||||
(identifier) @local.definition)
|
||||
(constant_binding
|
||||
(identifier) @local.definition)
|
||||
(type_bindings
|
||||
(identifier) @local.definition)
|
||||
|
||||
(function_declaration
|
||||
(prototype
|
||||
(parameter_list
|
||||
(parameters
|
||||
(parameter
|
||||
(name) @local.definition)))))
|
||||
|
||||
(identifier) @local.reference
|
||||
|
Loading…
Reference in New Issue
Block a user