diff options
author | zetashift | 2023-08-08 18:50:49 +0000 |
---|---|---|
committer | GitHub | 2023-08-08 18:50:49 +0000 |
commit | 294aa669a24ce10e5af32d2447f677bf6edd36d0 (patch) | |
tree | b3615b01a16ff576d3e262dd6594fb0da594a720 | |
parent | f01ca107fbf28c5dd65e238f775d708d738953b8 (diff) |
Add Unison support (#7724)
-rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
-rw-r--r-- | languages.toml | 23 | ||||
-rw-r--r-- | runtime/queries/unison/highlights.scm | 72 | ||||
-rw-r--r-- | runtime/queries/unison/injections.scm | 1 |
4 files changed, 97 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 28c421f4..38d4d9e9 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -155,6 +155,7 @@ | twig | ✓ | | | | | typescript | ✓ | ✓ | ✓ | `typescript-language-server` | | ungrammar | ✓ | | | | +| unison | ✓ | | | | | uxntal | ✓ | | | | | v | ✓ | ✓ | ✓ | `v-analyzer` | | vala | ✓ | | | `vala-language-server` | diff --git a/languages.toml b/languages.toml index c9a863ef..465b505b 100644 --- a/languages.toml +++ b/languages.toml @@ -2713,3 +2713,26 @@ injection-regex = "wren" file-types = ["wren"] roots = [] indent = { tab-width = 2, unit = " "} + +[[language]] +name = "unison" +scope = "source.unison" +injection-regex = "unison" +file-types = ["u"] +shebangs = [] +roots = [] +auto-format = false +comment-token = "--" +indent = { tab-width = 4, unit = " " } + +[language.auto-pairs] +'(' = ')' +'{' = '}' +'[' = ']' +'"' = '"' +'`' = '`' + +[[grammar]] +name = "unison" +source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "98c4e8bc5c9f5989814a720457cf36963cf4043d" } + diff --git a/runtime/queries/unison/highlights.scm b/runtime/queries/unison/highlights.scm new file mode 100644 index 00000000..8ec2b6ff --- /dev/null +++ b/runtime/queries/unison/highlights.scm @@ -0,0 +1,72 @@ +;; Primitives +(comment) @comment +(nat) @constant.numeric +(unit) @constant.builtin +(literal_char) @constant.character +(literal_text) @string +(literal_boolean) @constant.builtin.boolean + +;; Keywords +[ + (kw_forall) + (unique_kw) + (type_kw) + (kw_equals) + (do) +] @keyword + +(kw_let) @keyword.function +(type_kw) @keyword.storage.type +(unique) @keyword.storage.modifier +("use") @keyword.control.import + + +[ + (type_constructor) +] @constructor + +[ + (operator) + (pipe) + (arrow_symbol) + (">") + (or) + (bang) +] @operator + +[ + "if" + "else" + "then" + (match) + (with) + (cases) +] @keyword.control.conditional + +(blank_pattern) @variable.builtin + +;; Types +(record_field name: (wordy_id) @variable.other.member type: (wordy_id) @type) +[ + (type_name) + (type_signature) + (effect) +] @type + +(term_definition) @variable + +;; Punctuation +[ + (type_signature_colon) + ":" +] @punctuation.delimiter + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + diff --git a/runtime/queries/unison/injections.scm b/runtime/queries/unison/injections.scm new file mode 100644 index 00000000..4f0cc44c --- /dev/null +++ b/runtime/queries/unison/injections.scm @@ -0,0 +1 @@ +((doc_block) @injection.content (#set! injection.language "markdown")) |