aboutsummaryrefslogtreecommitdiffstats
path: root/queries/purescript
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/purescript
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/purescript')
-rw-r--r--queries/purescript/highlights.scm270
-rw-r--r--queries/purescript/injections.scm2
-rw-r--r--queries/purescript/locals.scm15
3 files changed, 167 insertions, 120 deletions
diff --git a/queries/purescript/highlights.scm b/queries/purescript/highlights.scm
index 247ea839e..b241ba852 100644
--- a/queries/purescript/highlights.scm
+++ b/queries/purescript/highlights.scm
@@ -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
-; ----------------------------------------------------------------------------
-; Punctuation
+(char) @character
- [
- "("
- ")"
- "{"
- "}"
- "["
- "]"
- ] @punctuation.bracket
+[
+ (string)
+ (triple_quote_string)
+] @string
- [
- (comma)
- ";"
- (qualified_module) ; grabs the `.` (dot), ex: import System.IO
- "."
- ] @punctuation.delimiter
+(comment) @comment @spell
+
+; ----------------------------------------------------------------------------
+; Punctuation
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+[
+ (comma)
+ ";"
+ (qualified_module) ; grabs the `.` (dot), ex: import System.IO
+ "."
+] @punctuation.delimiter
; ----------------------------------------------------------------------------
; Keywords, operators, includes
+[
+ "if"
+ "then"
+ "else"
+ "case"
+ "of"
+] @keyword.conditional
+
+[
+ "import"
+ "module"
+] @keyword.import
+
+[
+ (operator)
+ (constructor_operator)
+ (type_operator)
+ (all_names)
+ "="
+ "|"
+ "::"
+ "∷"
+ "=>"
+ "⇒"
+ "<="
+ "⇐"
+ "->"
+ "→"
+ "<-"
+ "←"
+ "\\"
+ "`"
+ "@"
+] @operator
- [
- "if"
- "then"
- "else"
- "case"
- "of"
- ] @keyword.conditional
+(qualified_module
+ (module) @constructor)
- [
- "import"
- "module"
- ] @keyword.import
+(module) @module
- [
- (operator)
- (constructor_operator)
- (type_operator)
- (all_names)
+(qualified_type
+ (module) @module)
- "="
- "|"
- "::"
- "∷"
- "=>"
- "⇒"
- "<="
- "⇐"
- "->"
- "→"
- "<-"
- "←"
- "\\"
- "`"
- "@"
- ] @operator
+(qualified_variable
+ (module) @module)
- (qualified_module (module) @constructor)
- (module) @module
- (qualified_type (module) @module)
- (qualified_variable (module) @module)
- (import (module) @module)
+(import
+ (module) @module)
- [
- (where)
- "let"
- "in"
- "class"
- "instance"
- "derive"
- "foreign"
- "data"
- "newtype"
- "type"
- "as"
- "hiding"
- "do"
- "ado"
- "forall"
- "∀"
- "infix"
- "infixl"
- "infixr"
- ] @keyword
+[
+ (where)
+ "let"
+ "in"
+ "class"
+ "instance"
+ "derive"
+ "foreign"
+ "data"
+ "newtype"
+ "type"
+ "as"
+ "hiding"
+ "do"
+ "ado"
+ "forall"
+ "∀"
+ "infix"
+ "infixl"
+ "infixr"
+] @keyword
- (class_instance "else" @keyword)
+(class_instance
+ "else" @keyword)
- (type_role_declaration
- "role" @keyword
- role: (type_role) @type.qualifier)
+(type_role_declaration
+ "role" @keyword
+ role: (type_role) @type.qualifier)
- (hole) @character.special
+(hole) @character.special
- ; `_` wildcards in if-then-else and case-of expressions,
- ; as well as record updates and operator sections
- (wildcard) @variable.parameter
+; `_` 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
+
+(exp_apply
+ .
+ (exp_name
+ (variable) @function))
+
+(exp_apply
+ .
+ (exp_name
+ (qualified_variable
+ (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)
- (variable) @variable
- (exp_apply . (exp_name (variable) @function))
- (exp_apply . (exp_name (qualified_variable (variable) @function)))
+(signature
+ name: (variable) @type)
- (row_field (field_name) @variable.member)
- (record_field (field_name) @variable.member)
- (record_accessor (variable) @variable.member)
- (exp_record_access (variable) @variable.member)
+(kind_declaration
+ (class_name) @type)
- (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)
+(function
+ name: (variable) @function)
- ; true or false
- ((variable) @boolean
+(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)
-; ----------------------------------------------------------------------------
-; Types
+(exp_ticked
+ (exp_name
+ (variable) @operator))
- (type) @type
+(exp_ticked
+ (exp_name
+ (qualified_variable
+ (variable) @operator)))
- (constructor) @constructor
+; ----------------------------------------------------------------------------
+; Types
+(type) @type
+(constructor) @constructor
diff --git a/queries/purescript/injections.scm b/queries/purescript/injections.scm
index 321c90add..2f0e58eb6 100644
--- a/queries/purescript/injections.scm
+++ b/queries/purescript/injections.scm
@@ -1,2 +1,2 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
diff --git a/queries/purescript/locals.scm b/queries/purescript/locals.scm
index 0d42125e2..16265231d 100644
--- a/queries/purescript/locals.scm
+++ b/queries/purescript/locals.scm
@@ -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