chore: query formatting

This commit is contained in:
Pham Huy Hoang 2024-01-06 15:05:50 +09:00 committed by Christian Clason
parent 79975d6557
commit 57a8acf0c4
674 changed files with 18466 additions and 12648 deletions

View file

@ -1,152 +1,192 @@
; ----------------------------------------------------------------------------
; Literals and comments
[
(integer)
(exp_negation)
] @number
(exp_literal (number)) @number.float
(char) @character
[
(string)
(triple_quote_string)
] @string
(comment) @comment @spell
(exp_literal
(number)) @number.float
(char) @character
[
(string)
(triple_quote_string)
] @string
(comment) @comment @spell
; ----------------------------------------------------------------------------
; Punctuation
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
(comma)
";"
(qualified_module) ; grabs the `.` (dot), ex: import System.IO
"."
] @punctuation.delimiter
[
(comma)
";"
(qualified_module) ; grabs the `.` (dot), ex: import System.IO
"."
] @punctuation.delimiter
; ----------------------------------------------------------------------------
; Keywords, operators, includes
[
"if"
"then"
"else"
"case"
"of"
] @keyword.conditional
[
"if"
"then"
"else"
"case"
"of"
] @keyword.conditional
[
"import"
"module"
] @keyword.import
[
"import"
"module"
] @keyword.import
[
(operator)
(constructor_operator)
(type_operator)
(all_names)
"="
"|"
"::"
"∷"
"=>"
"⇒"
"<="
"⇐"
"->"
"→"
"<-"
"←"
"\\"
"`"
"@"
] @operator
[
(operator)
(constructor_operator)
(type_operator)
(all_names)
(qualified_module
(module) @constructor)
"="
"|"
"::"
"∷"
"=>"
"⇒"
"<="
"⇐"
"->"
"→"
"<-"
"←"
"\\"
"`"
"@"
] @operator
(module) @module
(qualified_module (module) @constructor)
(module) @module
(qualified_type (module) @module)
(qualified_variable (module) @module)
(import (module) @module)
(qualified_type
(module) @module)
[
(where)
"let"
"in"
"class"
"instance"
"derive"
"foreign"
"data"
"newtype"
"type"
"as"
"hiding"
"do"
"ado"
"forall"
"∀"
"infix"
"infixl"
"infixr"
] @keyword
(qualified_variable
(module) @module)
(class_instance "else" @keyword)
(import
(module) @module)
(type_role_declaration
"role" @keyword
role: (type_role) @type.qualifier)
[
(where)
"let"
"in"
"class"
"instance"
"derive"
"foreign"
"data"
"newtype"
"type"
"as"
"hiding"
"do"
"ado"
"forall"
"∀"
"infix"
"infixl"
"infixr"
] @keyword
(hole) @character.special
(class_instance
"else" @keyword)
; `_` wildcards in if-then-else and case-of expressions,
; as well as record updates and operator sections
(wildcard) @variable.parameter
(type_role_declaration
"role" @keyword
role: (type_role) @type.qualifier)
(hole) @character.special
; `_` wildcards in if-then-else and case-of expressions,
; as well as record updates and operator sections
(wildcard) @variable.parameter
; ----------------------------------------------------------------------------
; Functions and variables
(variable) @variable
(variable) @variable
(exp_apply . (exp_name (variable) @function))
(exp_apply . (exp_name (qualified_variable (variable) @function)))
(exp_apply
.
(exp_name
(variable) @function))
(row_field (field_name) @variable.member)
(record_field (field_name) @variable.member)
(record_accessor (variable) @variable.member)
(exp_record_access (variable) @variable.member)
(exp_apply
.
(exp_name
(qualified_variable
(variable) @function)))
(signature name: (variable) @type)
(kind_declaration (class_name) @type)
(function name: (variable) @function)
(foreign_import (variable) @function)
(class_instance (instance_name) @function)
(derive_declaration (instance_name) @function)
(row_field
(field_name) @variable.member)
; true or false
((variable) @boolean
(record_field
(field_name) @variable.member)
(record_accessor
(variable) @variable.member)
(exp_record_access
(variable) @variable.member)
(signature
name: (variable) @type)
(kind_declaration
(class_name) @type)
(function
name: (variable) @function)
(foreign_import
(variable) @function)
(class_instance
(instance_name) @function)
(derive_declaration
(instance_name) @function)
; true or false
((variable) @boolean
(#any-of? @boolean "true" "false"))
; The former one works for `tree-sitter highlight` but not in Helix/Kakoune.
; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all
; as an operator and leaving it to the child nodes, and highlighting everything as an operator.
(exp_ticked (_) @operator)
(exp_ticked (exp_name (variable) @operator))
(exp_ticked (exp_name (qualified_variable (variable) @operator)))
; The former one works for `tree-sitter highlight` but not in Helix/Kakoune.
; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all
; as an operator and leaving it to the child nodes, and highlighting everything as an operator.
(exp_ticked
(_) @operator)
(exp_ticked
(exp_name
(variable) @operator))
(exp_ticked
(exp_name
(qualified_variable
(variable) @operator)))
; ----------------------------------------------------------------------------
; Types
(type) @type
(type) @type
(constructor) @constructor
(constructor) @constructor

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
(#set! injection.language "comment"))

View file

@ -1,4 +1,11 @@
(signature name: (variable)) @local.definition.type
(function name: (variable)) @local.definition.function
(pat_name (variable)) @local.definition
(exp_name (variable)) @local.reference
(signature
name: (variable)) @local.definition.type
(function
name: (variable)) @local.definition.function
(pat_name
(variable)) @local.definition
(exp_name
(variable)) @local.reference