on master help sign in
Upgrade haskell queries
commit9eacbc1887fd102a820c40add24f3a1cd2d994ed authorOwen Shepherd <owen@owen.cafe> dateWed 5 Jan 2022, 17:53 (5 years ago) parent41ee45c
1 file changed+115−38
runtime/queries/haskell/highlights.scm+115−38
runtime/queries/haskell/highlights.scm+115−38
@@ -1,45 +1,122 @@
1−(variable) @variable
2−(operator) @operator
3−(exp_name (constructor) @constructor)
4−(constructor_operator) @operator
5−(module) @namespace
6−(type) @type
7−(type) @class
8−(constructor) @constructor
9−(pragma) @pragma
10−(comment) @comment
11−(signature name: (variable) @type)
12−(function name: (variable) @function)
13−(constraint class: (class_name (type)) @class)
14−(class (class_head class: (class_name (type)) @class))
15−(instance (instance_head class: (class_name (type)) @class))
1+;; ----------------------------------------------------------------------------
2+;; Literals and comments
3+
164(integer) @constant.numeric.integer
5+(exp_negation) @constant.numeric.integer
176(exp_literal (float)) @constant.numeric.float
187(char) @constant.character
19−(con_unit) @literal
20−(con_list) @literal
21−(tycon_arrow) @operator
22−(where) @keyword
23−"module" @keyword
24−"let" @keyword
25−"in" @keyword
26−"class" @keyword
27−"instance" @keyword
28−"data" @keyword
29−"newtype" @keyword
30−"family" @keyword
31−"type" @keyword
32−"import" @keyword
33−"qualified" @keyword
34−"as" @keyword
35−"deriving" @keyword
36−"via" @keyword
37−"stock" @keyword
38−"anyclass" @keyword
39−"do" @keyword
40−"mdo" @keyword
41−"rec" @keyword
8+(string) @string
9+
10+(con_unit) @constant.builtin ; unit, as in ()
11+
12+(comment) @comment
13+
14+
15+;; ----------------------------------------------------------------------------
16+;; Punctuation
17+
4218[
4319 "("
4420 ")"
21+ "{"
22+ "}"
23+ "["
24+ "]"
4525] @punctuation.bracket
26+
27+[
28+ (comma)
29+ ";"
30+] @punctuation.delimiter
31+
32+
33+;; ----------------------------------------------------------------------------
34+;; Keywords, operators, includes
35+
36+(pragma) @constant.macro
37+
38+[
39+ "if"
40+ "then"
41+ "else"
42+ "case"
43+ "of"
44+] @keyword.control.conditional
45+
46+[
47+ "import"
48+ "qualified"
49+ "module"
50+] @keyword.control.import
51+
52+[
53+ (operator)
54+ (constructor_operator)
55+ (type_operator)
56+ (tycon_arrow)
57+ (qualified_module) ; grabs the `.` (dot), ex: import System.IO
58+ (all_names)
59+ (wildcard)
60+ "="
61+ "|"
62+ "::"
63+ "=>"
64+ "->"
65+ "<-"
66+ "\\"
67+ "`"
68+ "@"
69+] @operator
70+
71+(qualified_module (module) @constructor)
72+(qualified_type (module) @namespace)
73+(qualified_variable (module) @namespace)
74+(import (module) @namespace)
75+
76+[
77+ (where)
78+ "let"
79+ "in"
80+ "class"
81+ "instance"
82+ "data"
83+ "newtype"
84+ "family"
85+ "type"
86+ "as"
87+ "hiding"
88+ "deriving"
89+ "via"
90+ "stock"
91+ "anyclass"
92+ "do"
93+ "mdo"
94+ "rec"
95+ "forall"
96+ "∀"
97+] @keyword
98+
99+
100+;; ----------------------------------------------------------------------------
101+;; Functions and variables
102+
103+(signature name: (variable) @type)
104+(function name: (variable) @function)
105+
106+(variable) @variable
107+"_" @variable.builtin
108+
109+(exp_infix (variable) @operator) ; consider infix functions as operators
110+
111+("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
112+
113+
114+;; ----------------------------------------------------------------------------
115+;; Types
116+
117+(type) @type
118+
119+(constructor) @constructor
120+
121+; True or False
122+((constructor) @_bool (#match? @_bool "(True|False)")) @constant.builtin.boolean