aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavish Pegram <tapegram@gmail.com>2023-09-03 14:05:18 -0500
committerGitHub <noreply@github.com>2023-09-03 15:05:18 -0400
commit9d637b7ae8fa17cea8600e91d1145e2095c2a15d (patch)
treefd3fd95a54216b72b6de9f69fc070fe1140201a0
parentdocs: fix typo in README.md (diff)
downloadnvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.tar
nvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.tar.gz
nvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.tar.bz2
nvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.tar.lz
nvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.tar.xz
nvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.tar.zst
nvim-treesitter-9d637b7ae8fa17cea8600e91d1145e2095c2a15d.zip
Feat: Add unison (#5340)
* Add unison * Trivial change to force prepush hook * Undo change * PR Feedback - remove appended text in query after variable, update lockfile, remove main branch specification in parser * Replacing captures with only ones in the contributing.md * Fix typo * Generate from grammar * First group of suggested changes * Update gt operator * Remove outer parens * Remove maybe.c * Add comment injection
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/unison/highlights.scm73
-rw-r--r--queries/unison/injections.scm2
5 files changed, 88 insertions, 0 deletions
diff --git a/README.md b/README.md
index c35f05414..d127bd7a1 100644
--- a/README.md
+++ b/README.md
@@ -372,6 +372,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [twig](https://github.com/gbprod/tree-sitter-twig) (maintained by @gbprod)
- [x] [typescript](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka)
- [x] [ungrammar](https://github.com/Philipp-M/tree-sitter-ungrammar) (maintained by @Philipp-M, @amaanq)
+- [x] [unison](https://github.com/kylegoetz/tree-sitter-unison) (maintained by @tapegram)
- [x] [usd](https://github.com/ColinKennedy/tree-sitter-usd) (maintained by @ColinKennedy)
- [x] [uxn tal](https://github.com/amaanq/tree-sitter-uxntal) (maintained by @amaanq)
- [x] [v](https://github.com/v-analyzer/v-analyzer) (maintained by @kkharji, @amaanq)
diff --git a/lockfile.json b/lockfile.json
index e8de1156c..867f7984f 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -596,6 +596,9 @@
"ungrammar": {
"revision": "debd26fed283d80456ebafa33a06957b0c52e451"
},
+ "unison": {
+ "revision": "694c8c0c79f8d1b80d497401acf4d1b77bfb004a"
+ },
"usd": {
"revision": "718a6b3e939904e0b4fe7cff6742e96af4781f4b"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 246d41eab..460ccea18 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1751,6 +1751,15 @@ list.ungrammar = {
maintainers = { "@Philipp-M", "@amaanq" },
}
+list.unison = {
+ install_info = {
+ url = "https://github.com/kylegoetz/tree-sitter-unison",
+ files = { "src/parser.c", "src/scanner.c" },
+ requires_generate_from_grammar = true,
+ },
+ maintainers = { "@tapegram" },
+}
+
list.usd = {
install_info = {
url = "https://github.com/ColinKennedy/tree-sitter-usd",
diff --git a/queries/unison/highlights.scm b/queries/unison/highlights.scm
new file mode 100644
index 000000000..41f7e19bf
--- /dev/null
+++ b/queries/unison/highlights.scm
@@ -0,0 +1,73 @@
+;; Primitives
+(comment) @comment @spell
+(nat) @number
+(unit) @constant.builtin
+(literal_char) @character
+(literal_text) @string
+(literal_boolean) @boolean
+
+;; Keywords
+[
+ (kw_forall)
+ (unique_kw)
+ (type_kw)
+ (do)
+ (kw_let)
+] @keyword
+
+(kw_equals) @keyword.operator
+(structural_kw) @type.qualifier
+(unique) @type.qualifier
+
+(type_constructor) @constructor
+
+(doc_block) @comment.documentation
+
+
+[
+ (operator)
+ (pipe)
+ (arrow_symbol)
+ ">"
+ (or)
+] @keyword.operator
+
+[
+ "if"
+ "else"
+ "then"
+ (match)
+ (with)
+ (cases)
+] @conditional
+
+(blank_pattern) @variable.builtin
+
+(pattern) @variable (constructor_or_variable_pattern) @type
+
+(use_clause) @include
+
+;; Types
+(record_field name: (wordy_id) @variable type: (wordy_id) @type)
+[
+ (type_name)
+ (type_signature)
+ (effect)
+] @type
+
+(term_definition) @variable
+
+;; Punctuation
+[
+ (type_signature_colon)
+ ":"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
diff --git a/queries/unison/injections.scm b/queries/unison/injections.scm
new file mode 100644
index 000000000..321c90add
--- /dev/null
+++ b/queries/unison/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))