mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
fix(haskell): update queries and tests for rewritten parser (#6580)
This commit is contained in:
parent
0319e6eef5
commit
da0efd7398
6 changed files with 238 additions and 373 deletions
|
|
@ -270,7 +270,7 @@
|
||||||
"revision": "070524937539eb8bb4f10debd9c83b66c434f3a2"
|
"revision": "070524937539eb8bb4f10debd9c83b66c434f3a2"
|
||||||
},
|
},
|
||||||
"haskell": {
|
"haskell": {
|
||||||
"revision": "af32d884088ce7b74541b5e51820baa7e305caae"
|
"revision": "e29c59236283198d93740a796c50d1394bccbef5"
|
||||||
},
|
},
|
||||||
"haskell_persistent": {
|
"haskell_persistent": {
|
||||||
"revision": "577259b4068b2c281c9ebf94c109bd50a74d5857"
|
"revision": "577259b4068b2c281c9ebf94c109bd50a74d5857"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[
|
[
|
||||||
(exp_apply)
|
(apply)
|
||||||
(exp_do)
|
(do)
|
||||||
(function)
|
(function)
|
||||||
(import)+
|
(import)+
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -4,66 +4,37 @@
|
||||||
; and don't override destructured parameters
|
; and don't override destructured parameters
|
||||||
(variable) @variable
|
(variable) @variable
|
||||||
|
|
||||||
(pat_wildcard) @variable
|
(pattern/wildcard) @variable
|
||||||
|
|
||||||
(function
|
(decl/function
|
||||||
patterns: (patterns
|
patterns: (patterns
|
||||||
(_) @variable.parameter))
|
(_) @variable.parameter))
|
||||||
|
|
||||||
(exp_lambda
|
(expression/lambda
|
||||||
(_)+ @variable.parameter
|
(_)+ @variable.parameter
|
||||||
"->")
|
"->")
|
||||||
|
|
||||||
(function
|
(decl/function
|
||||||
infix: (infix
|
(infix
|
||||||
lhs: (_) @variable.parameter))
|
(pattern) @variable.parameter))
|
||||||
|
|
||||||
(function
|
|
||||||
infix: (infix
|
|
||||||
rhs: (_) @variable.parameter))
|
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Literals and comments
|
; Literals and comments
|
||||||
(integer) @number
|
(integer) @number
|
||||||
|
|
||||||
(exp_negation) @number
|
(negation) @number
|
||||||
|
|
||||||
(exp_literal
|
(expression/literal
|
||||||
(float)) @number.float
|
(float)) @number.float
|
||||||
|
|
||||||
(char) @character
|
(char) @character
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(con_unit) @string.special.symbol ; unit, as in ()
|
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
; FIXME: The below documentation comment queries are inefficient
|
(haddock) @comment.documentation
|
||||||
; and need to be anchored, using something like
|
|
||||||
; ((comment) @_first . (comment)+ @comment.documentation)
|
|
||||||
; once https://github.com/neovim/neovim/pull/24738 has been merged.
|
|
||||||
;
|
|
||||||
; ((comment) @comment.documentation
|
|
||||||
; (#lua-match? @comment.documentation "^-- |"))
|
|
||||||
;
|
|
||||||
; ((comment) @_first @comment.documentation
|
|
||||||
; (comment) @comment.documentation
|
|
||||||
; (#lua-match? @_first "^-- |"))
|
|
||||||
;
|
|
||||||
; ((comment) @comment.documentation
|
|
||||||
; (#lua-match? @comment.documentation "^-- %^"))
|
|
||||||
;
|
|
||||||
; ((comment) @_first @comment.documentation
|
|
||||||
; (comment) @comment.documentation
|
|
||||||
; (#lua-match? @_first "^-- %^"))
|
|
||||||
;
|
|
||||||
; ((comment) @comment.documentation
|
|
||||||
; (#lua-match? @comment.documentation "^{-"))
|
|
||||||
;
|
|
||||||
; ((comment) @_first @comment.documentation
|
|
||||||
; (comment) @comment.documentation
|
|
||||||
; (#lua-match? @_first "^{-"))
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Punctuation
|
; Punctuation
|
||||||
[
|
[
|
||||||
|
|
@ -76,7 +47,7 @@
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
(comma)
|
","
|
||||||
";"
|
";"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
|
@ -84,7 +55,7 @@
|
||||||
; Keywords, operators, includes
|
; Keywords, operators, includes
|
||||||
[
|
[
|
||||||
"forall"
|
"forall"
|
||||||
"∀"
|
; "∀" ; utf-8 is not cross-platform safe
|
||||||
] @keyword.repeat
|
] @keyword.repeat
|
||||||
|
|
||||||
(pragma) @keyword.directive
|
(pragma) @keyword.directive
|
||||||
|
|
@ -106,11 +77,6 @@
|
||||||
[
|
[
|
||||||
(operator)
|
(operator)
|
||||||
(constructor_operator)
|
(constructor_operator)
|
||||||
(type_operator)
|
|
||||||
(tycon_arrow)
|
|
||||||
(qualified_module) ; grabs the `.` (dot), ex: import System.IO
|
|
||||||
(qualified_type)
|
|
||||||
(qualified_variable)
|
|
||||||
(all_names)
|
(all_names)
|
||||||
(wildcard)
|
(wildcard)
|
||||||
"."
|
"."
|
||||||
|
|
@ -126,29 +92,11 @@
|
||||||
"@"
|
"@"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
(module) @module
|
(module
|
||||||
|
(module_id) @module)
|
||||||
((qualified_module
|
|
||||||
(module) @constructor)
|
|
||||||
.
|
|
||||||
(module))
|
|
||||||
|
|
||||||
(qualified_type
|
|
||||||
(module) @module)
|
|
||||||
|
|
||||||
(qualified_variable
|
|
||||||
(module) @module)
|
|
||||||
|
|
||||||
(import
|
|
||||||
(module) @module)
|
|
||||||
|
|
||||||
(import
|
|
||||||
(module) @constructor
|
|
||||||
.
|
|
||||||
(module))
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(where)
|
"where"
|
||||||
"let"
|
"let"
|
||||||
"in"
|
"in"
|
||||||
"class"
|
"class"
|
||||||
|
|
@ -174,212 +122,157 @@
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Functions and variables
|
; Functions and variables
|
||||||
(signature
|
(decl
|
||||||
name: (variable) @function)
|
[
|
||||||
|
name: (variable) @function
|
||||||
(function
|
names: (binding_list
|
||||||
name: (variable) @function)
|
(variable) @function)
|
||||||
|
|
||||||
(function
|
|
||||||
name: (variable) @variable
|
|
||||||
rhs: [
|
|
||||||
(exp_literal)
|
|
||||||
(exp_apply
|
|
||||||
(exp_name
|
|
||||||
[
|
|
||||||
(constructor)
|
|
||||||
(variable)
|
|
||||||
(qualified_variable)
|
|
||||||
]))
|
|
||||||
(quasiquote)
|
|
||||||
((exp_name)
|
|
||||||
.
|
|
||||||
(operator))
|
|
||||||
])
|
])
|
||||||
|
|
||||||
(function
|
(decl/bind
|
||||||
name: (variable) @variable
|
name: (variable) @variable)
|
||||||
rhs: (exp_infix
|
|
||||||
[
|
|
||||||
(exp_literal)
|
|
||||||
(exp_apply
|
|
||||||
(exp_name
|
|
||||||
[
|
|
||||||
(constructor)
|
|
||||||
(variable)
|
|
||||||
(qualified_variable)
|
|
||||||
]))
|
|
||||||
(quasiquote)
|
|
||||||
((exp_name)
|
|
||||||
.
|
|
||||||
(operator))
|
|
||||||
]))
|
|
||||||
|
|
||||||
; Consider signatures (and accompanying functions)
|
; Consider signatures (and accompanying functions)
|
||||||
; with only one value on the rhs as variables
|
; with only one value on the rhs as variables
|
||||||
(signature
|
(decl/signature
|
||||||
.
|
name: (variable) @variable
|
||||||
(variable) @variable
|
type: (type))
|
||||||
.
|
|
||||||
(_) .)
|
|
||||||
|
|
||||||
((signature
|
((decl/signature
|
||||||
.
|
|
||||||
(variable) @_name
|
|
||||||
.
|
|
||||||
(_) .)
|
|
||||||
.
|
|
||||||
(function
|
|
||||||
name: (variable) @variable)
|
|
||||||
(#eq? @_name @variable))
|
|
||||||
|
|
||||||
; but consider a type that involves 'IO' a function
|
|
||||||
(signature
|
|
||||||
name: (variable) @function
|
|
||||||
.
|
|
||||||
(type_apply
|
|
||||||
(type_name) @_type)
|
|
||||||
(#eq? @_type "IO"))
|
|
||||||
|
|
||||||
((signature
|
|
||||||
name: (variable) @_name
|
name: (variable) @_name
|
||||||
|
type: (type))
|
||||||
.
|
.
|
||||||
(type_apply
|
(decl
|
||||||
(type_name) @_type)
|
name: (variable) @variable)
|
||||||
|
match: (_)(#eq? @_name @variable))
|
||||||
|
|
||||||
|
; but consider a type that involves 'IO' a decl/function
|
||||||
|
(decl/signature
|
||||||
|
name: (variable) @function
|
||||||
|
type: (type/apply
|
||||||
|
constructor: (name) @_type)
|
||||||
|
(#eq? @_type "IO"))
|
||||||
|
|
||||||
|
((decl/signature
|
||||||
|
name: (variable) @_name
|
||||||
|
type: (type/apply
|
||||||
|
constructor: (name) @_type)
|
||||||
(#eq? @_type "IO"))
|
(#eq? @_type "IO"))
|
||||||
.
|
.
|
||||||
(function
|
(decl
|
||||||
name: (variable) @function)
|
name: (variable) @function)
|
||||||
(#eq? @_name @function))
|
match: (_)(#eq? @_name @function))
|
||||||
|
|
||||||
; functions with parameters
|
((decl/signature) @function
|
||||||
; + accompanying signatures
|
|
||||||
(function
|
|
||||||
name: (variable) @function
|
|
||||||
patterns: (patterns))
|
|
||||||
|
|
||||||
((signature) @function
|
|
||||||
.
|
.
|
||||||
(function
|
(decl/function
|
||||||
name: (variable) @function
|
name: (variable) @function))
|
||||||
patterns: (patterns)))
|
|
||||||
|
|
||||||
(function
|
(decl/bind
|
||||||
name: (variable) @function
|
name: (variable) @function
|
||||||
rhs: (exp_lambda))
|
(match
|
||||||
|
expression: (expression/lambda)))
|
||||||
|
|
||||||
; view patterns
|
; view patterns
|
||||||
(pat_view
|
(view_pattern
|
||||||
(exp_name
|
[
|
||||||
[
|
(expression/variable) @function.call
|
||||||
(variable) @function.call
|
(expression/qualified
|
||||||
(qualified_variable
|
(variable) @function.call)
|
||||||
(variable) @function.call)
|
])
|
||||||
]))
|
|
||||||
|
|
||||||
; consider infix functions as operators
|
; consider infix functions as operators
|
||||||
(exp_infix
|
(infix_id
|
||||||
[
|
[
|
||||||
(variable) @operator
|
(variable) @operator
|
||||||
(qualified_variable
|
(qualified
|
||||||
(variable) @operator)
|
(variable) @operator)
|
||||||
])
|
])
|
||||||
|
|
||||||
; partially applied infix functions (sections) also get highlighted as operators
|
; decl/function calls with an infix operator
|
||||||
(exp_section_right
|
|
||||||
[
|
|
||||||
(variable) @operator
|
|
||||||
(qualified_variable
|
|
||||||
(variable) @operator)
|
|
||||||
])
|
|
||||||
|
|
||||||
(exp_section_left
|
|
||||||
[
|
|
||||||
(variable) @operator
|
|
||||||
(qualified_variable
|
|
||||||
(variable) @operator)
|
|
||||||
])
|
|
||||||
|
|
||||||
; function calls with an infix operator
|
|
||||||
; e.g. func <$> a <*> b
|
; e.g. func <$> a <*> b
|
||||||
(exp_infix
|
(infix
|
||||||
(exp_name
|
left_operand: [
|
||||||
[
|
(variable) @function.call
|
||||||
(variable) @function.call
|
(qualified
|
||||||
(qualified_variable
|
((module) @module
|
||||||
((module) @module
|
(variable) @function.call))
|
||||||
(variable) @function.call))
|
])
|
||||||
])
|
|
||||||
.
|
|
||||||
(operator))
|
|
||||||
|
|
||||||
; infix operators applied to variables
|
; infix operators applied to variables
|
||||||
((exp_name
|
((expression/variable) @variable
|
||||||
(variable) @variable)
|
|
||||||
.
|
.
|
||||||
(operator))
|
(operator))
|
||||||
|
|
||||||
((operator)
|
((operator)
|
||||||
.
|
.
|
||||||
(exp_name
|
|
||||||
[
|
|
||||||
(variable) @variable
|
|
||||||
(qualified_variable
|
|
||||||
(variable) @variable)
|
|
||||||
]))
|
|
||||||
|
|
||||||
; function calls with infix operators
|
|
||||||
((exp_name
|
|
||||||
[
|
[
|
||||||
(variable) @function.call
|
(expression/variable) @variable
|
||||||
(qualified_variable
|
(expression/qualified
|
||||||
(variable) @function.call)
|
(variable) @variable)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
; infix operator function definitions
|
||||||
|
(function
|
||||||
|
(infix
|
||||||
|
left_operand: [
|
||||||
|
(variable) @variable
|
||||||
|
(qualified
|
||||||
|
((module) @module
|
||||||
|
(variable) @variable))
|
||||||
|
])
|
||||||
|
match: (match))
|
||||||
|
|
||||||
|
; decl/function calls with infix operators
|
||||||
|
([
|
||||||
|
(expression/variable) @function.call
|
||||||
|
(expression/qualified
|
||||||
|
(variable) @function.call)
|
||||||
|
]
|
||||||
.
|
.
|
||||||
(operator) @_op
|
(operator) @_op
|
||||||
(#any-of? @_op "$" "<$>" ">>=" "=<<"))
|
(#any-of? @_op "$" "<$>" ">>=" "=<<"))
|
||||||
|
|
||||||
; right hand side of infix operator
|
; right hand side of infix operator
|
||||||
((exp_infix
|
((infix
|
||||||
[
|
[
|
||||||
(operator)
|
(operator)
|
||||||
(variable)
|
(infix_id
|
||||||
|
(variable))
|
||||||
] ; infix or `func`
|
] ; infix or `func`
|
||||||
.
|
.
|
||||||
(exp_name
|
[
|
||||||
[
|
(variable) @function.call
|
||||||
(variable) @function.call
|
(qualified
|
||||||
(qualified_variable
|
(variable) @function.call)
|
||||||
(variable) @function.call)
|
])
|
||||||
]))
|
|
||||||
.
|
.
|
||||||
(operator) @_op
|
(operator) @_op
|
||||||
(#any-of? @_op "$" "<$>" "=<<"))
|
(#any-of? @_op "$" "<$>" "=<<"))
|
||||||
|
|
||||||
; function composition, arrows, monadic composition (lhs)
|
; decl/function composition, arrows, monadic composition (lhs)
|
||||||
((exp_name
|
([
|
||||||
[
|
(expression/variable) @function
|
||||||
(variable) @function
|
(expression/qualified
|
||||||
(qualified_variable
|
(variable) @function)
|
||||||
(variable) @function)
|
]
|
||||||
])
|
|
||||||
.
|
.
|
||||||
(operator) @_op
|
(operator) @_op
|
||||||
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
|
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
|
||||||
|
|
||||||
; right hand side of infix operator
|
; right hand side of infix operator
|
||||||
((exp_infix
|
((infix
|
||||||
[
|
[
|
||||||
(operator)
|
(operator)
|
||||||
(variable)
|
(infix_id
|
||||||
|
(variable))
|
||||||
] ; infix or `func`
|
] ; infix or `func`
|
||||||
.
|
.
|
||||||
(exp_name
|
[
|
||||||
[
|
(variable) @function
|
||||||
(variable) @function
|
(qualified
|
||||||
(qualified_variable
|
(variable) @function)
|
||||||
(variable) @function)
|
])
|
||||||
]))
|
|
||||||
.
|
.
|
||||||
(operator) @_op
|
(operator) @_op
|
||||||
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
|
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
|
||||||
|
|
@ -387,157 +280,123 @@
|
||||||
; function composition, arrows, monadic composition (rhs)
|
; function composition, arrows, monadic composition (rhs)
|
||||||
((operator) @_op
|
((operator) @_op
|
||||||
.
|
.
|
||||||
(exp_name
|
[
|
||||||
[
|
(expression/variable) @function
|
||||||
(variable) @function
|
(expression/qualified
|
||||||
(qualified_variable
|
(variable) @function)
|
||||||
(variable) @function)
|
]
|
||||||
])
|
|
||||||
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
|
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
|
||||||
|
|
||||||
; function defined in terms of a function composition
|
; function defined in terms of a function composition
|
||||||
(function
|
(decl/function
|
||||||
name: (variable) @function
|
name: (variable) @function
|
||||||
rhs: (exp_infix
|
(match
|
||||||
(_)
|
expression: (infix
|
||||||
.
|
operator: (operator) @_op
|
||||||
(operator) @_op
|
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))))
|
||||||
.
|
|
||||||
(_)
|
|
||||||
(#any-of? @_op "." ">>>" "***" ">=>" "<=<")))
|
|
||||||
|
|
||||||
(exp_apply
|
(apply
|
||||||
(exp_name
|
[
|
||||||
[
|
(expression/variable) @function.call
|
||||||
(variable) @function.call
|
(expression/qualified
|
||||||
(qualified_variable
|
(variable) @function.call)
|
||||||
(variable) @function.call)
|
])
|
||||||
]))
|
|
||||||
|
|
||||||
; function compositions, in parentheses, applied
|
; function compositions, in parentheses, applied
|
||||||
; lhs
|
; lhs
|
||||||
(exp_apply
|
(apply
|
||||||
.
|
.
|
||||||
(exp_parens
|
(expression/parens
|
||||||
(exp_infix
|
(infix
|
||||||
(exp_name
|
[
|
||||||
[
|
(variable) @function.call
|
||||||
(variable) @function.call
|
(qualified
|
||||||
(qualified_variable
|
(variable) @function.call)
|
||||||
(variable) @function.call)
|
]
|
||||||
])
|
|
||||||
.
|
.
|
||||||
(operator))))
|
(operator))))
|
||||||
|
|
||||||
; rhs
|
; rhs
|
||||||
(exp_apply
|
(apply
|
||||||
.
|
.
|
||||||
(exp_parens
|
(expression/parens
|
||||||
(exp_infix
|
(infix
|
||||||
(operator)
|
(operator)
|
||||||
.
|
.
|
||||||
(exp_name
|
[
|
||||||
[
|
(variable) @function.call
|
||||||
(variable) @function.call
|
(qualified
|
||||||
(qualified_variable
|
(variable) @function.call)
|
||||||
(variable) @function.call)
|
])))
|
||||||
]))))
|
|
||||||
|
|
||||||
; variables being passed to a function call
|
; variables being passed to a function call
|
||||||
(exp_apply
|
(apply
|
||||||
(_)+
|
(_)
|
||||||
.
|
|
||||||
(exp_name
|
|
||||||
[
|
|
||||||
(variable) @variable
|
|
||||||
(qualified_variable
|
|
||||||
(variable) @variable)
|
|
||||||
]))
|
|
||||||
|
|
||||||
; Consider functions with only one value on the rhs
|
|
||||||
; as variables, e.g. x = Rec {} or x = foo
|
|
||||||
(function
|
|
||||||
.
|
|
||||||
(variable) @variable
|
|
||||||
.
|
.
|
||||||
[
|
[
|
||||||
(exp_record)
|
(expression/variable) @variable
|
||||||
(exp_name
|
(expression/qualified
|
||||||
[
|
(variable) @variable)
|
||||||
(variable)
|
])
|
||||||
(qualified_variable)
|
|
||||||
])
|
|
||||||
(exp_list)
|
|
||||||
(exp_tuple)
|
|
||||||
(exp_cond)
|
|
||||||
] .)
|
|
||||||
|
|
||||||
; main is always a function
|
; main is always a function
|
||||||
; (this prevents `main = undefined` from being highlighted as a variable)
|
; (this prevents `main = undefined` from being highlighted as a variable)
|
||||||
(function
|
(decl/bind
|
||||||
name: (variable) @function
|
name: (variable) @function
|
||||||
(#eq? @function "main"))
|
(#eq? @function "main"))
|
||||||
|
|
||||||
; scoped function types (func :: a -> b)
|
; scoped function types (func :: a -> b)
|
||||||
(pat_typed
|
(signature
|
||||||
pattern: (pat_name
|
pattern: (pattern/variable) @function
|
||||||
(variable) @function)
|
type: (function))
|
||||||
type: (fun))
|
|
||||||
|
|
||||||
; signatures that have a function type
|
; signatures that have a function type
|
||||||
; + functions that follow them
|
; + binds that follow them
|
||||||
(signature
|
(decl/signature
|
||||||
(variable) @function
|
name: (variable) @function
|
||||||
(fun))
|
type: (function))
|
||||||
|
|
||||||
((signature
|
((decl/signature
|
||||||
(variable) @_type
|
name: (variable) @_name
|
||||||
(fun))
|
type: (quantified_type))
|
||||||
.
|
.
|
||||||
(function
|
(decl/bind
|
||||||
(variable) @function)
|
(variable) @function)
|
||||||
(#eq? @function @_type))
|
(#eq? @function @_name))
|
||||||
|
|
||||||
(signature
|
; Treat constructor assignments (smart constructors) as functions, e.g. mkJust = Just
|
||||||
(variable) @function
|
(bind
|
||||||
(context
|
name: (variable) @function
|
||||||
(fun)))
|
match: (match
|
||||||
|
expression: (constructor)))
|
||||||
|
|
||||||
((signature
|
; Function composition
|
||||||
(variable) @_type
|
(bind
|
||||||
(context
|
name: (variable) @function
|
||||||
(fun)))
|
match: (match
|
||||||
.
|
expression: (infix
|
||||||
(function
|
operator: (operator) @_op
|
||||||
(variable) @function)
|
(#eq? @_op "."))))
|
||||||
(#eq? @function @_type))
|
|
||||||
|
|
||||||
((signature
|
|
||||||
(variable) @function
|
|
||||||
(forall
|
|
||||||
(context
|
|
||||||
(fun))))
|
|
||||||
.
|
|
||||||
(function
|
|
||||||
(variable)))
|
|
||||||
|
|
||||||
((signature
|
|
||||||
(variable) @_type
|
|
||||||
(forall
|
|
||||||
(context
|
|
||||||
(fun))))
|
|
||||||
.
|
|
||||||
(function
|
|
||||||
(variable) @function)
|
|
||||||
(#eq? @function @_type))
|
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Types
|
; Types
|
||||||
(type) @type
|
(name) @type
|
||||||
|
|
||||||
(type_star) @type
|
(type/unit) @type
|
||||||
|
|
||||||
(type_variable) @type
|
(type/unit
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @type)
|
||||||
|
|
||||||
|
(type/list
|
||||||
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @type)
|
||||||
|
|
||||||
|
(type/star) @type
|
||||||
|
|
||||||
(constructor) @constructor
|
(constructor) @constructor
|
||||||
|
|
||||||
|
|
@ -554,26 +413,24 @@
|
||||||
(quoter) @function.call
|
(quoter) @function.call
|
||||||
|
|
||||||
(quasiquote
|
(quasiquote
|
||||||
[
|
quoter: [
|
||||||
(quoter) @_name
|
(quoter) @_name
|
||||||
(_
|
(quoter
|
||||||
(variable) @_name)
|
(qualified
|
||||||
|
id: (variable) @_name))
|
||||||
]
|
]
|
||||||
(#eq? @_name "qq")
|
(#eq? @_name "qq")
|
||||||
(quasiquote_body) @string)
|
body: (quasiquote_body) @string)
|
||||||
|
|
||||||
(quasiquote
|
|
||||||
(_
|
|
||||||
(variable) @_name)
|
|
||||||
(#eq? @_name "qq")
|
|
||||||
(quasiquote_body) @string)
|
|
||||||
|
|
||||||
; namespaced quasi-quoter
|
; namespaced quasi-quoter
|
||||||
(quasiquote
|
(quoter
|
||||||
(_
|
[
|
||||||
(module) @module
|
(variable) @function.call
|
||||||
.
|
(_
|
||||||
(variable) @function.call))
|
(module) @module
|
||||||
|
.
|
||||||
|
(variable) @function.call)
|
||||||
|
])
|
||||||
|
|
||||||
; Highlighting of quasiquote_body for other languages is handled by injections.scm
|
; Highlighting of quasiquote_body for other languages is handled by injections.scm
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
|
|
@ -595,28 +452,15 @@
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Fields
|
; Fields
|
||||||
(field
|
(field_name
|
||||||
(variable) @variable.member)
|
(variable) @variable.member)
|
||||||
|
|
||||||
(pat_field
|
(import_name
|
||||||
(variable) @variable.member)
|
(name)
|
||||||
|
|
||||||
(exp_projection
|
|
||||||
field: (variable) @variable.member)
|
|
||||||
|
|
||||||
(import_item
|
|
||||||
(type)
|
|
||||||
.
|
.
|
||||||
(import_con_names
|
(children
|
||||||
(variable) @variable.member))
|
(variable) @variable.member))
|
||||||
|
|
||||||
(exp_field
|
|
||||||
field: [
|
|
||||||
(variable) @variable.member
|
|
||||||
(qualified_variable
|
|
||||||
(variable) @variable.member)
|
|
||||||
])
|
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Spell checking
|
; Spell checking
|
||||||
(comment) @spell
|
(comment) @spell
|
||||||
|
|
|
||||||
9
queries/haskell/locals.scm
Normal file
9
queries/haskell/locals.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
(signature
|
||||||
|
name: (variable)) @local.definition
|
||||||
|
|
||||||
|
(function
|
||||||
|
name: (variable)) @local.definition
|
||||||
|
|
||||||
|
(pattern/variable) @local.definition
|
||||||
|
|
||||||
|
(expression/variable) @local.reference
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
-- ^ @keyword.directive
|
-- ^ @keyword.directive
|
||||||
|
|
||||||
|
{-| Main module -}
|
||||||
|
-- ^ @comment.documentation
|
||||||
module Main
|
module Main
|
||||||
-- ^ @keyword.import
|
-- ^ @keyword.import
|
||||||
-- ^ @module
|
-- ^ @module
|
||||||
( main
|
( main
|
||||||
|
-- ^ @variable
|
||||||
) where
|
) where
|
||||||
-- ^ @keyword
|
-- ^ @keyword
|
||||||
|
|
||||||
|
|
@ -16,12 +19,12 @@ import Prelude hiding (show)
|
||||||
import Data.Map (fromList)
|
import Data.Map (fromList)
|
||||||
-- ^ @module
|
-- ^ @module
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
-- ^ @constructor
|
-- ^ @module
|
||||||
-- ^ @module
|
-- ^ @module
|
||||||
import qualified Chronos
|
import qualified Chronos
|
||||||
-- ^ @module
|
-- ^ @module
|
||||||
import qualified Chronos as C
|
import qualified Chronos as C
|
||||||
-- ^ @constructor
|
-- ^ @module
|
||||||
-- ^ @module
|
-- ^ @module
|
||||||
import FooMod (BarTy (barField))
|
import FooMod (BarTy (barField))
|
||||||
-- ^ @variable.member
|
-- ^ @variable.member
|
||||||
|
|
@ -47,9 +50,9 @@ mkAQualified x = SomeModule.A x
|
||||||
|
|
||||||
class Ord a => PartialOrd a
|
class Ord a => PartialOrd a
|
||||||
-- ^ @type
|
-- ^ @type
|
||||||
-- ^ @type
|
-- ^ @variable
|
||||||
-- ^ @type
|
-- ^ @type
|
||||||
-- ^ @type
|
-- ^ @variable
|
||||||
|
|
||||||
instance Ord ADT where
|
instance Ord ADT where
|
||||||
-- ^ @type
|
-- ^ @type
|
||||||
|
|
@ -78,7 +81,7 @@ main :: IO ()
|
||||||
-- ^ @function
|
-- ^ @function
|
||||||
-- ^ @operator
|
-- ^ @operator
|
||||||
-- ^ @type
|
-- ^ @type
|
||||||
-- ^ @string.special.symbol
|
-- ^ @type
|
||||||
main = undefined
|
main = undefined
|
||||||
-- ^ @function
|
-- ^ @function
|
||||||
-- ^ @keyword.exception
|
-- ^ @keyword.exception
|
||||||
|
|
@ -95,14 +98,20 @@ someFunc0 x = someFunc1 x
|
||||||
-- ^ @number
|
-- ^ @number
|
||||||
scopedTypeParam (x :: Int) = someFunc x
|
scopedTypeParam (x :: Int) = someFunc x
|
||||||
-- ^ @variable.parameter
|
-- ^ @variable.parameter
|
||||||
|
-- ^ @type
|
||||||
scopedTypeParam (Just x :: Int) = someFunc x
|
scopedTypeParam (Just x :: Int) = someFunc x
|
||||||
|
-- ^ @constructor
|
||||||
-- ^ @variable.parameter
|
-- ^ @variable.parameter
|
||||||
|
-- ^ @type
|
||||||
|
scopedTypeParam (f :: Int -> Int) = someFunc x
|
||||||
|
-- ^ @function
|
||||||
|
|
||||||
someInfix :: Integral a => a -> Double
|
someInfix :: Integral a => a -> Double
|
||||||
-- ^ @type
|
-- ^ @type
|
||||||
-- ^ @type
|
-- ^ @variable
|
||||||
-- ^ @operator
|
-- ^ @operator
|
||||||
-- ^ @type
|
-- ^ @variable
|
||||||
|
-- ^ @type
|
||||||
someInfix x = fromIntegral x `myAdd` floatVal
|
someInfix x = fromIntegral x `myAdd` floatVal
|
||||||
-- ^ @function.call
|
-- ^ @function.call
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
|
|
@ -149,8 +158,10 @@ someInfix x = fromIntegral x `myAdd` floatVal
|
||||||
|
|
||||||
someIOaction :: IO ()
|
someIOaction :: IO ()
|
||||||
-- ^ @function
|
-- ^ @function
|
||||||
someIOaction = do
|
anotherIOaction :: IO ()
|
||||||
-- ^ @keyword
|
anotherIOaction = do
|
||||||
|
-- ^ @function
|
||||||
|
-- ^ @keyword
|
||||||
foo <- SomeModule.someFun <$> getArgs
|
foo <- SomeModule.someFun <$> getArgs
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
-- ^ @module
|
-- ^ @module
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ local ts = vim.treesitter
|
||||||
|
|
||||||
local COMMENT_NODES = {
|
local COMMENT_NODES = {
|
||||||
markdown = "html_block",
|
markdown = "html_block",
|
||||||
|
haskell = "haddock",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function check_assertions(file)
|
local function check_assertions(file)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue