mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-11-28 21:20:23 +03:00
feat(languages): Elm (#1514)
* Add Elm language support * Fix docs gen * Updates based on PR feedback
This commit is contained in:
parent
440d4ae9df
commit
b2c8aa1ee7
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -206,3 +206,7 @@
|
|||||||
path = helix-syntax/languages/tree-sitter-git-config
|
path = helix-syntax/languages/tree-sitter-git-config
|
||||||
url = https://github.com/the-mikedavis/tree-sitter-git-config.git
|
url = https://github.com/the-mikedavis/tree-sitter-git-config.git
|
||||||
shallow = true
|
shallow = true
|
||||||
|
[submodule "helix-syntax/languages/tree-sitter-elm"]
|
||||||
|
path = helix-syntax/languages/tree-sitter-elm
|
||||||
|
url = https://github.com/elm-tooling/tree-sitter-elm
|
||||||
|
shallow = true
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
| dart | ✓ | | ✓ | `dart` |
|
| dart | ✓ | | ✓ | `dart` |
|
||||||
| dockerfile | ✓ | | | `docker-langserver` |
|
| dockerfile | ✓ | | | `docker-langserver` |
|
||||||
| elixir | ✓ | | | `elixir-ls` |
|
| elixir | ✓ | | | `elixir-ls` |
|
||||||
|
| elm | ✓ | | | `elm-language-server` |
|
||||||
| fish | ✓ | ✓ | ✓ | |
|
| fish | ✓ | ✓ | ✓ | |
|
||||||
| git-commit | ✓ | | | |
|
| git-commit | ✓ | | | |
|
||||||
| git-config | ✓ | | | |
|
| git-config | ✓ | | | |
|
||||||
|
1
helix-syntax/languages/tree-sitter-elm
Submodule
1
helix-syntax/languages/tree-sitter-elm
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit bd50ccf66b42c55252ac8efc1086af4ac6bab8cd
|
@ -567,3 +567,14 @@ file-types = [".gitmodules", ".gitconfig"]
|
|||||||
injection-regex = "git-config"
|
injection-regex = "git-config"
|
||||||
comment-token = "#"
|
comment-token = "#"
|
||||||
indent = { tab-width = 4, unit = "\t" }
|
indent = { tab-width = 4, unit = "\t" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "elm"
|
||||||
|
scope = "source.elm"
|
||||||
|
injection-regex = "elm"
|
||||||
|
file-types = ["elm"]
|
||||||
|
roots = ["elm.json"]
|
||||||
|
auto-format = true
|
||||||
|
comment-token = "--"
|
||||||
|
language-server = { command = "elm-language-server" }
|
||||||
|
indent = { tab-width = 4, unit = " " }
|
||||||
|
83
runtime/queries/elm/highlights.scm
Normal file
83
runtime/queries/elm/highlights.scm
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
; Keywords
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"then"
|
||||||
|
"else"
|
||||||
|
"let"
|
||||||
|
"in"
|
||||||
|
] @keyword.control
|
||||||
|
(case) @keyword.control
|
||||||
|
(of) @keyword.control
|
||||||
|
|
||||||
|
(colon) @keyword.operator
|
||||||
|
(backslash) @keyword
|
||||||
|
(as) @keyword
|
||||||
|
(port) @keyword
|
||||||
|
(exposing) @keyword
|
||||||
|
(alias) @keyword
|
||||||
|
(infix) @keyword
|
||||||
|
|
||||||
|
(arrow) @keyword.operator
|
||||||
|
(dot) @keyword.operator
|
||||||
|
|
||||||
|
(port) @keyword
|
||||||
|
|
||||||
|
(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.contol.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
|
4
runtime/queries/elm/injections.scm
Normal file
4
runtime/queries/elm/injections.scm
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
; Parse glsl where defined
|
||||||
|
|
||||||
|
((glsl_content) @injection.content
|
||||||
|
(#set! injection.language "glsl"))
|
14
runtime/queries/elm/locals.scm
Normal file
14
runtime/queries/elm/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/elm/tags.scm
Normal file
19
runtime/queries/elm/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
|
Loading…
Reference in New Issue
Block a user