mirror of https://github.com/helix-editor/helix
feat: Add Clarity language support (#13647)
parent
67f1fe20c3
commit
17fb12bcf3
|
@ -21,6 +21,7 @@
|
|||
| capnp | ✓ | | ✓ | |
|
||||
| cel | ✓ | | | |
|
||||
| circom | ✓ | | | `circom-lsp` |
|
||||
| clarity | ✓ | | | `clarinet` |
|
||||
| clojure | ✓ | | | `clojure-lsp` |
|
||||
| cmake | ✓ | ✓ | ✓ | `cmake-language-server` |
|
||||
| codeql | ✓ | ✓ | | `codeql` |
|
||||
|
|
|
@ -261,6 +261,10 @@ enable = true
|
|||
[language-server.vscode-eslint-language-server.config.workingDirectory]
|
||||
mode = "location"
|
||||
|
||||
[language-server.clarinet]
|
||||
command = "clarinet"
|
||||
args = ["lsp"]
|
||||
|
||||
[[language]]
|
||||
name = "rust"
|
||||
scope = "source.rust"
|
||||
|
@ -4371,3 +4375,18 @@ injection-regex = "rust-format-args"
|
|||
[[grammar]]
|
||||
name = "rust-format-args"
|
||||
source = { git = "https://github.com/nik-rev/tree-sitter-rustfmt", rev = "2ca0bdd763d0c9dbb1d0bd14aea7544cbe81309c" }
|
||||
|
||||
[[language]]
|
||||
name = "clarity"
|
||||
scope = "source.clar"
|
||||
injection-regex = "clarity"
|
||||
file-types = ["clar"]
|
||||
roots = ["Clarinet.toml"]
|
||||
comment-tokens = ";;"
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
language-servers = [ "clarinet" ]
|
||||
|
||||
[[grammar]]
|
||||
name = "clarity"
|
||||
source = { git = "https://github.com/xlittlerag/tree-sitter-clarity", rev = "7fa54825fdd971a1a676f885384f024fe2b7384a" }
|
||||
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
; Comments
|
||||
(comment) @comment
|
||||
|
||||
; Literals
|
||||
[
|
||||
(int_lit)
|
||||
(uint_lit)
|
||||
] @constant.numeric.integer
|
||||
|
||||
[
|
||||
(bool_lit)
|
||||
(none_lit)
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
(ascii_string_lit)
|
||||
(utf8_string_lit)
|
||||
] @string
|
||||
|
||||
[
|
||||
(buffer_lit)
|
||||
(standard_principal_lit)
|
||||
(contract_principal_lit)
|
||||
] @string.special
|
||||
|
||||
; Types
|
||||
[
|
||||
(native_type)
|
||||
(trait_type)
|
||||
] @type
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Keywords
|
||||
(list_lit_token) @keyword
|
||||
(some_lit ("some") @keyword)
|
||||
(response_lit [
|
||||
"ok"
|
||||
"err"
|
||||
] @keyword)
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"mod"
|
||||
"pow"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"and"
|
||||
"or"
|
||||
"xor"
|
||||
] @keyword.operator
|
||||
|
||||
; Functions
|
||||
(function_signature (identifier) @function)
|
||||
(function_signature_for_trait (identifier) @function)
|
||||
(contract_function_call operator: (identifier) @function)
|
||||
|
||||
(basic_native_form operator: (native_identifier) @function.builtin)
|
||||
[
|
||||
"let"
|
||||
] @function.builtin
|
||||
|
||||
[
|
||||
"impl-trait"
|
||||
"use-trait"
|
||||
"define-trait"
|
||||
"define-read-only"
|
||||
"define-private"
|
||||
"define-public"
|
||||
"define-data-var"
|
||||
"define-fungible-token"
|
||||
"define-non-fungible-token"
|
||||
"define-constant"
|
||||
"define-map"
|
||||
] @function.special
|
||||
|
||||
; Variables and parameters
|
||||
(function_parameter) @variable.parameter
|
||||
(trait_usage trait_alias: (identifier) @type.parameter)
|
||||
|
||||
(tuple_lit key: (identifier) @variable)
|
||||
(tuple_type key: (identifier) @variable)
|
||||
(tuple_type_for_trait key: (identifier) @variable)
|
||||
|
||||
(global) @variable.builtin
|
||||
|
Loading…
Reference in New Issue