helix-mods/runtime/queries/haskell/highlights.scm

139 lines
2.4 KiB
Scheme
Raw Normal View History

2022-01-05 18:53:37 +01:00
;; ----------------------------------------------------------------------------
;; Literals and comments
(integer) @constant.numeric.integer
2022-01-05 18:53:37 +01:00
(exp_negation) @constant.numeric.integer
(exp_literal (float)) @constant.numeric.float
(char) @constant.character
2022-01-05 18:53:37 +01:00
(string) @string
(con_unit) @constant.builtin ; unit, as in ()
(comment) @comment
;; ----------------------------------------------------------------------------
;; Punctuation
2021-09-06 07:33:02 +02:00
[
"("
")"
2022-01-05 18:53:37 +01:00
"{"
"}"
"["
"]"
2021-09-06 07:33:02 +02:00
] @punctuation.bracket
2022-01-05 18:53:37 +01:00
[
(comma)
";"
] @punctuation.delimiter
;; ----------------------------------------------------------------------------
;; Keywords, operators, includes
[
"forall"
"∀"
] @keyword.control.repeat
2022-01-05 18:53:37 +01:00
(pragma) @constant.macro
[
"if"
"then"
"else"
"case"
"of"
] @keyword.control.conditional
[
"import"
"qualified"
"module"
] @keyword.control.import
[
(operator)
(constructor_operator)
(type_operator)
(tycon_arrow)
(qualified_module) ; grabs the `.` (dot), ex: import System.IO
(all_names)
(wildcard)
"="
"|"
"::"
"=>"
"->"
"<-"
"\\"
"`"
"@"
] @operator
(module) @namespace
2022-01-05 18:53:37 +01:00
[
(where)
"let"
"in"
"class"
"instance"
"data"
"newtype"
"family"
"type"
"as"
"hiding"
"deriving"
"via"
"stock"
"anyclass"
"do"
"mdo"
"rec"
"infix"
"infixl"
"infixr"
2022-01-05 18:53:37 +01:00
] @keyword
;; ----------------------------------------------------------------------------
;; Functions and variables
(signature name: (variable) @type)
(function
name: (variable) @function
patterns: (patterns))
((signature (fun)) . (function (variable) @function))
((signature (context (fun))) . (function (variable) @function))
((signature (forall (context (fun)))) . (function (variable) @function))
2022-01-05 18:53:37 +01:00
(exp_infix (variable) @operator) ; consider infix functions as operators
(exp_infix (exp_name) @function)
(exp_apply . (exp_name (variable) @function))
(exp_apply . (exp_name (qualified_variable (variable) @function)))
2022-01-05 18:53:37 +01:00
(variable) @variable
(pat_wildcard) @variable
2022-01-05 18:53:37 +01:00
;; ----------------------------------------------------------------------------
;; Types
(type) @type
(type_variable) @type.parameter
2022-01-05 18:53:37 +01:00
(constructor) @constructor
; True or False
((constructor) @_bool (#match? @_bool "(True|False)")) @constant.builtin.boolean
;; ----------------------------------------------------------------------------
;; Quasi-quotes
(quoter) @function
; Highlighting of quasiquote_body is handled by injections.scm