Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump tree-sitter-haskell and update queries #8558

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "haskell"
source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "98fc7f59049aeb713ab9b72a8ff25dcaaef81087" }
source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "d7ac98f49e3ed7e17541256fe3881a967d7ffdd3" }

[[language]]
name = "haskell-persistent"
Expand Down
35 changes: 24 additions & 11 deletions runtime/queries/haskell/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
;; ----------------------------------------------------------------------------
;; Keywords, operators, includes

[
"forall"
"∀"
] @keyword.control.repeat

(pragma) @constant.macro

[
Expand Down Expand Up @@ -68,10 +73,7 @@
"@"
] @operator

(qualified_module (module) @constructor)
(qualified_type (module) @namespace)
(qualified_variable (module) @namespace)
(import (module) @namespace)
(module) @namespace

[
(where)
Expand All @@ -92,8 +94,6 @@
"do"
"mdo"
"rec"
"forall"
"∀"
"infix"
"infixl"
"infixr"
Expand All @@ -104,22 +104,35 @@
;; Functions and variables

(signature name: (variable) @type)
(function name: (variable) @function)

(variable) @variable
"_" @variable.builtin
(function
name: (variable) @function
patterns: (patterns))
((signature (fun)) . (function (variable) @function))
((signature (context (fun))) . (function (variable) @function))
((signature (forall (context (fun)))) . (function (variable) @function))

(exp_infix (variable) @operator) ; consider infix functions as operators

("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
(exp_infix (exp_name) @function)
(exp_apply . (exp_name (variable) @function))
(exp_apply . (exp_name (qualified_variable (variable) @function)))

(variable) @variable
(pat_wildcard) @variable

;; ----------------------------------------------------------------------------
;; Types

(type) @type
(type_variable) @type

(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
Loading