on master help sign in
Add Unison support (#7724)
commit294aa669a24ce10e5af32d2447f677bf6edd36d0 authorzetashift <rskaraya@gmail.com> dateTue 8 Aug 2023, 20:50 (3 years ago) parentf01ca10
4 files changed+97
book/src/generated/lang-support.md+1 languages.toml+23 runtime/queries/unison/highlights.scm+72 runtime/queries/unison/injections.scm+1
book/src/generated/lang-support.md+1
@@ -155,6 +155,7 @@
155155| twig | ✓ | | | |
156156| typescript | ✓ | ✓ | ✓ | `typescript-language-server` |
157157| ungrammar | ✓ | | | |
158+| unison | ✓ | | | |
158159| uxntal | ✓ | | | |
159160| v | ✓ | ✓ | ✓ | `v-analyzer` |
160161| vala | ✓ | | | `vala-language-server` |
languages.toml+23
@@ -2713,3 +2713,26 @@ injection-regex = "wren"
27132713file-types = ["wren"]
27142714roots = []
27152715indent = { tab-width = 2, unit = " "}
2716+
2717+[[language]]
2718+name = "unison"
2719+scope = "source.unison"
2720+injection-regex = "unison"
2721+file-types = ["u"]
2722+shebangs = []
2723+roots = []
2724+auto-format = false
2725+comment-token = "--"
2726+indent = { tab-width = 4, unit = " " }
2727+
2728+[language.auto-pairs]
2729+'(' = ')'
2730+'{' = '}'
2731+'[' = ']'
2732+'"' = '"'
2733+'`' = '`'
2734+
2735+[[grammar]]
2736+name = "unison"
2737+source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "98c4e8bc5c9f5989814a720457cf36963cf4043d" }
2738+
runtime/queries/unison/highlights.scmnew file+72
@@ -0,0 +1,72 @@
1+;; Primitives
2+(comment) @comment
3+(nat) @constant.numeric
4+(unit) @constant.builtin
5+(literal_char) @constant.character
6+(literal_text) @string
7+(literal_boolean) @constant.builtin.boolean
8+
9+;; Keywords
10+[
11+ (kw_forall)
12+ (unique_kw)
13+ (type_kw)
14+ (kw_equals)
15+ (do)
16+] @keyword
17+
18+(kw_let) @keyword.function
19+(type_kw) @keyword.storage.type
20+(unique) @keyword.storage.modifier
21+("use") @keyword.control.import
22+
23+
24+[
25+ (type_constructor)
26+] @constructor
27+
28+[
29+ (operator)
30+ (pipe)
31+ (arrow_symbol)
32+ (">")
33+ (or)
34+ (bang)
35+] @operator
36+
37+[
38+ "if"
39+ "else"
40+ "then"
41+ (match)
42+ (with)
43+ (cases)
44+] @keyword.control.conditional
45+
46+(blank_pattern) @variable.builtin
47+
48+;; Types
49+(record_field name: (wordy_id) @variable.other.member type: (wordy_id) @type)
50+[
51+ (type_name)
52+ (type_signature)
53+ (effect)
54+] @type
55+
56+(term_definition) @variable
57+
58+;; Punctuation
59+[
60+ (type_signature_colon)
61+ ":"
62+] @punctuation.delimiter
63+
64+[
65+ "("
66+ ")"
67+ "{"
68+ "}"
69+ "["
70+ "]"
71+] @punctuation.bracket
72+
runtime/queries/unison/injections.scmnew file+1
@@ -0,0 +1 @@
1+((doc_block) @injection.content (#set! injection.language "markdown"))