aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/unison
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/unison
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/unison')
-rw-r--r--runtime/queries/unison/folds.scm10
-rw-r--r--runtime/queries/unison/highlights.scm125
-rw-r--r--runtime/queries/unison/injections.scm2
3 files changed, 137 insertions, 0 deletions
diff --git a/runtime/queries/unison/folds.scm b/runtime/queries/unison/folds.scm
new file mode 100644
index 000000000..3bfc585c3
--- /dev/null
+++ b/runtime/queries/unison/folds.scm
@@ -0,0 +1,10 @@
+[
+ (fold)
+ (type_declaration)
+ (term_declaration)
+ (literal_list)
+ (exp_if)
+ (pattern)
+ (parenthesized_or_tuple_pattern)
+ (delay_block)
+] @fold
diff --git a/runtime/queries/unison/highlights.scm b/runtime/queries/unison/highlights.scm
new file mode 100644
index 000000000..5fa721046
--- /dev/null
+++ b/runtime/queries/unison/highlights.scm
@@ -0,0 +1,125 @@
+; Primitives
+(comment) @comment @spell
+
+(nat) @number
+
+(unit) @constant.builtin
+
+(literal_char) @character
+
+(literal_text) @string
+
+(literal_boolean) @boolean
+
+; Keywords
+(type_kw) @keyword.type
+
+[
+ (kw_forall)
+ (do)
+ (kw_let)
+ (ability)
+ (where)
+] @keyword
+
+(structural) @keyword.modifier
+
+(unique) @keyword.modifier
+
+(type_constructor) @constructor
+
+((doc_block) @comment.documentation @spell
+ (#set! priority 90))
+
+[
+ (operator)
+ (pipe)
+ (arrow_symbol)
+ (or)
+ (kw_equals)
+] @operator
+
+[
+ "if"
+ "else"
+ "then"
+ (match)
+ (with)
+ (cases)
+] @keyword.conditional
+
+(blank_pattern) @variable.builtin
+
+(pattern) @variable
+
+(use_clause) @keyword.import
+
+; Types
+(record_field
+ (field_name) @variable.member
+ type: (regular_identifier) @type)
+
+(type_name) @type
+
+(type_declaration
+ (regular_identifier) @type)
+
+(ability_name
+ (path)? @module
+ (regular_identifier) @type)
+
+(ability_declaration
+ (ability_name) @type
+ (type_argument) @variable.parameter)
+
+(constructor
+ (constructor_name) @constructor)
+
+(constructor
+ type: (regular_identifier) @type)
+
+(effect
+ (regular_identifier) @attribute) ; NOTE: an effect is a special type
+
+; Namespaces
+(path) @module
+
+(namespace) @module
+
+; Terms
+(type_signature
+ term_name: (path) @module
+ term_name: (regular_identifier) @variable)
+
+(type_signature
+ term_name: (regular_identifier) @variable)
+
+(term_type) @type
+
+(term_definition
+ name: (path) @module)
+
+(term_definition
+ name: (regular_identifier) @variable)
+
+(term_definition
+ param: (regular_identifier) @variable.parameter)
+
+; Punctuation
+[
+ (type_signature_colon)
+ ":"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+(watch_expression) @keyword.directive
+
+(test_watch_expression) @keyword.directive
diff --git a/runtime/queries/unison/injections.scm b/runtime/queries/unison/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/runtime/queries/unison/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))