mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-18 13:07:06 +04:00
Add support for the Gren programming language (#12525)
This commit is contained in:
parent
27bb2447db
commit
f69659c5be
@ -81,6 +81,7 @@
|
||||
| gowork | ✓ | | | `gopls` |
|
||||
| gpr | ✓ | | | `ada_language_server` |
|
||||
| graphql | ✓ | ✓ | | `graphql-lsp` |
|
||||
| gren | ✓ | ✓ | | |
|
||||
| groovy | ✓ | | | |
|
||||
| gts | ✓ | ✓ | ✓ | `typescript-language-server`, `vscode-eslint-language-server`, `ember-language-server` |
|
||||
| hare | ✓ | | | |
|
||||
|
@ -4051,3 +4051,17 @@ language-servers = ["codeql"]
|
||||
[[grammar]]
|
||||
name = "ql"
|
||||
source = { git = "https://github.com/tree-sitter/tree-sitter-ql", rev = "1fd627a4e8bff8c24c11987474bd33112bead857" }
|
||||
|
||||
[[language]]
|
||||
name = "gren"
|
||||
scope = "source.gren"
|
||||
injection-regex = "gren"
|
||||
file-types = ["gren"]
|
||||
roots = ["gren.json"]
|
||||
comment-tokens = "--"
|
||||
block-comment-tokens = { start = "{-", end = "-}" }
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "gren"
|
||||
source = { git = "https://github.com/MaeBrooks/tree-sitter-gren", rev = "76554f4f2339f5a24eed19c58f2079b51c694152" }
|
||||
|
81
runtime/queries/gren/highlights.scm
Normal file
81
runtime/queries/gren/highlights.scm
Normal file
@ -0,0 +1,81 @@
|
||||
; Keywords
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"let"
|
||||
"in"
|
||||
] @keyword.control
|
||||
(when) @keyword.control
|
||||
(is) @keyword.control
|
||||
|
||||
(colon) @keyword.operator
|
||||
(backslash) @keyword
|
||||
(as) @keyword
|
||||
(port) @keyword
|
||||
(exposing) @keyword
|
||||
(alias) @keyword
|
||||
(infix) @keyword
|
||||
|
||||
(arrow) @keyword.operator
|
||||
(dot) @keyword.operator
|
||||
|
||||
(type_annotation(lower_case_identifier) @function)
|
||||
(port_annotation(lower_case_identifier) @function)
|
||||
(file (value_declaration (function_declaration_left(lower_case_identifier) @function)))
|
||||
|
||||
(field name: (lower_case_identifier) @attribute)
|
||||
(field_access_expr(lower_case_identifier) @attribute)
|
||||
|
||||
(operator_identifier) @keyword.operator
|
||||
(eq) @keyword.operator.assignment
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
"|" @keyword
|
||||
"," @punctuation.delimiter
|
||||
|
||||
[
|
||||
"|>"
|
||||
] @keyword
|
||||
|
||||
|
||||
(import) @keyword.control.import
|
||||
(module) @keyword.other
|
||||
|
||||
(number_constant_expr) @constant.numeric
|
||||
|
||||
(type) @type
|
||||
|
||||
(type_declaration(upper_case_identifier) @type)
|
||||
(type_ref) @type
|
||||
(type_alias_declaration name: (upper_case_identifier) @type)
|
||||
|
||||
(union_pattern constructor: (upper_case_qid (upper_case_identifier) @label (dot) (upper_case_identifier) @variable.other.member))
|
||||
(union_pattern constructor: (upper_case_qid (upper_case_identifier) @variable.other.member))
|
||||
|
||||
(union_variant(upper_case_identifier) @variable.other.member)
|
||||
(value_expr name: (value_qid (upper_case_identifier) @label))
|
||||
(value_expr (upper_case_qid (upper_case_identifier) @label (dot) (upper_case_identifier) @variable.other.member))
|
||||
(value_expr(upper_case_qid(upper_case_identifier)) @variable.other.member)
|
||||
|
||||
; comments
|
||||
(line_comment) @comment
|
||||
(block_comment) @comment
|
||||
|
||||
; strings
|
||||
(string_escape) @constant.character.escape
|
||||
|
||||
(open_quote) @string
|
||||
(close_quote) @string
|
||||
(regular_string_part) @string
|
||||
|
||||
(open_char) @constant.character
|
||||
(close_char) @constant.character
|
14
runtime/queries/gren/locals.scm
Normal file
14
runtime/queries/gren/locals.scm
Normal file
@ -0,0 +1,14 @@
|
||||
(value_declaration) @local.scope
|
||||
(type_alias_declaration) @local.scope
|
||||
(type_declaration) @local.scope
|
||||
(type_annotation) @local.scope
|
||||
(port_annotation) @local.scope
|
||||
(infix_declaration) @local.scope
|
||||
(let_in_expr) @local.scope
|
||||
|
||||
(function_declaration_left (lower_pattern (lower_case_identifier)) @local.definition)
|
||||
(function_declaration_left (lower_case_identifier) @local.definition)
|
||||
|
||||
(value_expr(value_qid(upper_case_identifier)) @local.reference)
|
||||
(value_expr(value_qid(lower_case_identifier)) @local.reference)
|
||||
(type_ref (upper_case_qid) @local.reference)
|
19
runtime/queries/gren/tags.scm
Normal file
19
runtime/queries/gren/tags.scm
Normal file
@ -0,0 +1,19 @@
|
||||
(value_declaration (function_declaration_left (lower_case_identifier) @name)) @definition.function
|
||||
|
||||
(function_call_expr (value_expr (value_qid) @name)) @reference.function
|
||||
(exposed_value (lower_case_identifier) @name) @reference.function
|
||||
(type_annotation ((lower_case_identifier) @name) (colon)) @reference.function
|
||||
|
||||
(type_declaration ((upper_case_identifier) @name) ) @definition.type
|
||||
|
||||
(type_ref (upper_case_qid (upper_case_identifier) @name)) @reference.type
|
||||
(exposed_type (upper_case_identifier) @name) @reference.type
|
||||
|
||||
(type_declaration (union_variant (upper_case_identifier) @name)) @definition.union
|
||||
|
||||
(value_expr (upper_case_qid (upper_case_identifier) @name)) @reference.union
|
||||
|
||||
|
||||
(module_declaration
|
||||
(upper_case_qid (upper_case_identifier)) @name
|
||||
) @definition.module
|
56
runtime/queries/gren/textobjects.scm
Normal file
56
runtime/queries/gren/textobjects.scm
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
(line_comment) @comment.inside
|
||||
(line_comment)+ @comment.around
|
||||
(block_comment) @comment.inside
|
||||
(block_comment)+ @comment.around
|
||||
|
||||
((type_annotation)?
|
||||
(value_declaration
|
||||
(function_declaration_left (lower_case_identifier))
|
||||
(eq)
|
||||
(_) @function.inside
|
||||
)
|
||||
) @function.around
|
||||
|
||||
(parenthesized_expr
|
||||
(anonymous_function_expr
|
||||
(
|
||||
(arrow)
|
||||
(_) @function.inside
|
||||
)
|
||||
)
|
||||
) @function.around
|
||||
|
||||
(value_declaration
|
||||
(function_declaration_left
|
||||
(lower_pattern
|
||||
(lower_case_identifier) @parameter.inside @parameter.around
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(value_declaration
|
||||
(function_declaration_left
|
||||
(pattern) @parameter.inside @parameter.around
|
||||
)
|
||||
)
|
||||
|
||||
(value_declaration
|
||||
(function_declaration_left
|
||||
(record_pattern
|
||||
(lower_pattern
|
||||
(lower_case_identifier) @parameter.inside
|
||||
)
|
||||
) @parameter.around
|
||||
)
|
||||
)
|
||||
|
||||
(parenthesized_expr
|
||||
(anonymous_function_expr
|
||||
(
|
||||
(backslash)
|
||||
(pattern) @parameter.inside
|
||||
(arrow)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user