aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/unison/highlights.scm
blob: 711779295f2658dd99a4e9a1afcdb21ef46ce118 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
;; Primitives
(comment) @comment
(nat) @constant.numeric
(unit) @constant.builtin
(literal_char) @constant.character
(literal_text) @string
(literal_boolean) @constant.builtin.boolean

;; Keywords
[
  (kw_forall)
  (type_kw)
  (kw_equals)
  (do)
  (ability)
  (where)
] @keyword

(kw_let) @keyword.function
(type_kw) @keyword.storage.type
(unique) @keyword.storage.modifier
(structural) @keyword.storage.modifier
("use") @keyword.control.import


[
  (type_constructor)
] @constructor

[
  (operator)
  (pipe)
  (arrow_symbol)
  (">")
  (or)
  (and)
  (bang)
] @operator

[
  "if"
  "else"
  "then"
  (match)
  (with)
  (cases)
] @keyword.control.conditional

(blank_pattern) @variable.builtin

;; Types
(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

;; Namespaces
(path) @namespace
(namespace) @namespace

;; Terms
(type_signature term_name: (path)? @variable term_name: (wordy_id) @variable)
(type_signature (wordy_id) @type)
(type_signature (term_type(delayed(wordy_id))) @type)

(term_definition param: (wordy_id) @variable.parameter)

(function_application function_name: (path)? function_name: (wordy_id) @function)

;; Punctuation
[
  (type_signature_colon)
  ":"
] @punctuation.delimiter

[
  "("
  ")"
  "{"
  "}"
  "["
  "]"
] @punctuation.bracket

(test_watch_expression (wordy_id) @keyword.directive)