From 06d6f4c0aaebd138b0362c8e58358d5704e6db39 Mon Sep 17 00:00:00 2001 From: zetashift Date: Fri, 2 Feb 2024 20:46:46 +0000 Subject: [PATCH 1/3] Update Unison tree-sitter grammar for type changes --- languages.toml | 2 +- runtime/queries/unison/highlights.scm | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/languages.toml b/languages.toml index ba3b190667dd..6ca5ca6c9896 100644 --- a/languages.toml +++ b/languages.toml @@ -2940,7 +2940,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "unison" -source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "aaec316774c8b50d367ec7cf26523aac5ef0cfc5" } +source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "1f505e2447fa876a87aee47ff3d70b9e141c744f" } [[language]] name = "todotxt" diff --git a/runtime/queries/unison/highlights.scm b/runtime/queries/unison/highlights.scm index d58285ed8a90..711779295f26 100644 --- a/runtime/queries/unison/highlights.scm +++ b/runtime/queries/unison/highlights.scm @@ -9,8 +9,6 @@ ;; Keywords [ (kw_forall) - (unique_kw) - (structural_kw) (type_kw) (kw_equals) (do) @@ -51,7 +49,7 @@ (blank_pattern) @variable.builtin ;; Types -(record_field name: (wordy_id) @variable.other.member type: (wordy_id) @type) +(record_field name: (wordy_id) @variable.other.member type: (_) @type) (type_constructor (type_name (wordy_id) @constructor)) (ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @variable.parameter) (effect (wordy_id) @special) ;; NOTE: an effect is just like a type, but in signature we special case it From 75aa8571e77884cc319ef0c59eb077ac20b6df24 Mon Sep 17 00:00:00 2001 From: zetashift Date: Fri, 2 Feb 2024 21:20:10 +0000 Subject: [PATCH 2/3] Add indent queries for Unison --- book/src/generated/lang-support.md | 2 +- runtime/queries/unison/indents.scm | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/unison/indents.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index a78dd7935bc3..1a6aa96b8b47 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -173,7 +173,7 @@ | typescript | ✓ | ✓ | ✓ | `typescript-language-server` | | typst | ✓ | | | `typst-lsp` | | ungrammar | ✓ | | | | -| unison | ✓ | | | | +| unison | ✓ | | ✓ | | | uxntal | ✓ | | | | | v | ✓ | ✓ | ✓ | `v-analyzer` | | vala | ✓ | | | `vala-language-server` | diff --git a/runtime/queries/unison/indents.scm b/runtime/queries/unison/indents.scm new file mode 100644 index 000000000000..10db7c4ca26d --- /dev/null +++ b/runtime/queries/unison/indents.scm @@ -0,0 +1,14 @@ +[ + (term_definition) + (type_declaration) + (pattern) + (tuple_or_parenthesized) + (literal_list) + (tuple_pattern) + (function_application) + (exp_if) + (constructor) + (delay_block) + (type_signature) +] @indent + From 3c3c47e360d3c408f45e67da2576735ac6cf4fe8 Mon Sep 17 00:00:00 2001 From: zetashift Date: Fri, 2 Feb 2024 21:50:28 +0000 Subject: [PATCH 3/3] Improve Unison indent queries --- runtime/queries/unison/indents.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/queries/unison/indents.scm b/runtime/queries/unison/indents.scm index 10db7c4ca26d..6cb15517cfdc 100644 --- a/runtime/queries/unison/indents.scm +++ b/runtime/queries/unison/indents.scm @@ -12,3 +12,4 @@ (type_signature) ] @indent +[(kw_then) (kw_else) (cases)] @indent.always @extend