From c5be87ad3efb69a025d06a91fd48ed2fba9b8ba1 Mon Sep 17 00:00:00 2001 From: zetashift Date: Mon, 11 Nov 2024 20:01:13 +0100 Subject: refactor(unison): update to latest treesitter grammar --- .github/workflows/update-lockfile.yml | 2 +- lockfile.json | 2 +- queries/unison/highlights.scm | 52 +++++++++++++++++++++-------------- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/.github/workflows/update-lockfile.yml b/.github/workflows/update-lockfile.yml index 455269f6f..353cc7475 100644 --- a/.github/workflows/update-lockfile.yml +++ b/.github/workflows/update-lockfile.yml @@ -31,7 +31,7 @@ jobs: - name: Update parsers env: - SKIP_LOCKFILE_UPDATE_FOR_LANGS: "gnuplot,unison" + SKIP_LOCKFILE_UPDATE_FOR_LANGS: "gnuplot" run: | cp lockfile.json /tmp/old_lockfile.json nvim -l scripts/write-lockfile.lua diff --git a/lockfile.json b/lockfile.json index e32609f29..811e5afc7 100644 --- a/lockfile.json +++ b/lockfile.json @@ -837,7 +837,7 @@ "revision": "debd26fed283d80456ebafa33a06957b0c52e451" }, "unison": { - "revision": "bc06e1eb100e1c0fab9bd89a9ca55d646ac80fc4" + "revision": "3c97db76d3cdbd002dfba493620c2d5df2fd6fa9" }, "usd": { "revision": "4e0875f724d94d0c2ff36f9b8cb0b12f8b20d216" diff --git a/queries/unison/highlights.scm b/queries/unison/highlights.scm index 39c2393c2..5fa721046 100644 --- a/queries/unison/highlights.scm +++ b/queries/unison/highlights.scm @@ -12,33 +12,32 @@ (literal_boolean) @boolean ; Keywords +(type_kw) @keyword.type + [ (kw_forall) - (unique) - (type_kw) (do) (kw_let) (ability) (where) ] @keyword -(kw_equals) @keyword.operator - (structural) @keyword.modifier (unique) @keyword.modifier (type_constructor) @constructor -(doc_block) @comment.documentation +((doc_block) @comment.documentation @spell + (#set! priority 90)) [ (operator) (pipe) (arrow_symbol) - ">" (or) -] @keyword.operator + (kw_equals) +] @operator [ "if" @@ -53,23 +52,34 @@ (pattern) @variable -(constructor_or_variable_pattern) @type - (use_clause) @keyword.import ; Types (record_field - name: (wordy_id) @variable - type: (wordy_id) @type) + (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 - (wordy_id) @attribute) ; NOTE: an effect is a special type + (regular_identifier) @attribute) ; NOTE: an effect is a special type ; Namespaces (path) @module @@ -79,22 +89,21 @@ ; Terms (type_signature term_name: (path) @module - term_name: (wordy_id) @variable) + term_name: (regular_identifier) @variable) (type_signature - term_name: (wordy_id) @variable) + term_name: (regular_identifier) @variable) (term_type) @type -(function_application - function_name: (path) - function_name: (wordy_id) @function) +(term_definition + name: (path) @module) (term_definition - name: (wordy_id) @variable) + name: (regular_identifier) @variable) (term_definition - param: (wordy_id) @variable.parameter) + param: (regular_identifier) @variable.parameter) ; Punctuation [ @@ -111,5 +120,6 @@ "]" ] @punctuation.bracket -(test_watch_expression - (wordy_id) @keyword.directive) +(watch_expression) @keyword.directive + +(test_watch_expression) @keyword.directive -- cgit v1.2.3-70-g09d2