From d839931e1462efabf4e7052a7c79a6b5bf3e408d Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Sat, 1 Jan 2022 19:20:10 +0000 Subject: [PATCH 1/3] Upgrade and reenable tree-sitter-haskell --- helix-syntax/build.rs | 1 - helix-syntax/languages/tree-sitter-haskell | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/helix-syntax/build.rs b/helix-syntax/build.rs index 28f85e74f24c..fa8be8b380c2 100644 --- a/helix-syntax/build.rs +++ b/helix-syntax/build.rs @@ -175,7 +175,6 @@ fn build_dir(dir: &str, language: &str) { fn main() { let ignore = vec![ "tree-sitter-typescript".to_string(), - "tree-sitter-haskell".to_string(), // aarch64 failures: https://github.com/tree-sitter/tree-sitter-haskell/issues/34 "tree-sitter-ocaml".to_string(), ]; let dirs = collect_tree_sitter_dirs(&ignore).unwrap(); diff --git a/helix-syntax/languages/tree-sitter-haskell b/helix-syntax/languages/tree-sitter-haskell index 237f4eb4417c..b6ec26f181dd 160000 --- a/helix-syntax/languages/tree-sitter-haskell +++ b/helix-syntax/languages/tree-sitter-haskell @@ -1 +1 @@ -Subproject commit 237f4eb4417c28f643a29d795ed227246afb66f9 +Subproject commit b6ec26f181dd059eedd506fa5fbeae1b8e5556c8 From 54cb21455c34bdb42d94db4548f5263e3c9d82d6 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Wed, 5 Jan 2022 17:53:37 +0000 Subject: [PATCH 2/3] Upgrade haskell queries --- runtime/queries/haskell/highlights.scm | 153 +++++++++++++++++++------ 1 file changed, 115 insertions(+), 38 deletions(-) diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index 8006cb079775..3f5d6de50096 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -1,45 +1,122 @@ -(variable) @variable -(operator) @operator -(exp_name (constructor) @constructor) -(constructor_operator) @operator -(module) @namespace -(type) @type -(type) @class -(constructor) @constructor -(pragma) @pragma -(comment) @comment -(signature name: (variable) @type) -(function name: (variable) @function) -(constraint class: (class_name (type)) @class) -(class (class_head class: (class_name (type)) @class)) -(instance (instance_head class: (class_name (type)) @class)) +;; ---------------------------------------------------------------------------- +;; Literals and comments + (integer) @constant.numeric.integer +(exp_negation) @constant.numeric.integer (exp_literal (float)) @constant.numeric.float (char) @constant.character -(con_unit) @literal -(con_list) @literal -(tycon_arrow) @operator -(where) @keyword -"module" @keyword -"let" @keyword -"in" @keyword -"class" @keyword -"instance" @keyword -"data" @keyword -"newtype" @keyword -"family" @keyword -"type" @keyword -"import" @keyword -"qualified" @keyword -"as" @keyword -"deriving" @keyword -"via" @keyword -"stock" @keyword -"anyclass" @keyword -"do" @keyword -"mdo" @keyword -"rec" @keyword +(string) @string + +(con_unit) @constant.builtin ; unit, as in () + +(comment) @comment + + +;; ---------------------------------------------------------------------------- +;; Punctuation + [ "(" ")" + "{" + "}" + "[" + "]" ] @punctuation.bracket + +[ + (comma) + ";" +] @punctuation.delimiter + + +;; ---------------------------------------------------------------------------- +;; Keywords, operators, includes + +(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 + +(qualified_module (module) @constructor) +(qualified_type (module) @namespace) +(qualified_variable (module) @namespace) +(import (module) @namespace) + +[ + (where) + "let" + "in" + "class" + "instance" + "data" + "newtype" + "family" + "type" + "as" + "hiding" + "deriving" + "via" + "stock" + "anyclass" + "do" + "mdo" + "rec" + "forall" + "∀" +] @keyword + + +;; ---------------------------------------------------------------------------- +;; Functions and variables + +(signature name: (variable) @type) +(function name: (variable) @function) + +(variable) @variable +"_" @variable.builtin + +(exp_infix (variable) @operator) ; consider infix functions as operators + +("@" @namespace) ; "as" pattern operator, e.g. x@Constructor + + +;; ---------------------------------------------------------------------------- +;; Types + +(type) @type + +(constructor) @constructor + +; True or False +((constructor) @_bool (#match? @_bool "(True|False)")) @constant.builtin.boolean From 305645c8760a62a83310c9c0d653b80161b0a26e Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Thu, 6 Jan 2022 21:05:29 +0000 Subject: [PATCH 3/3] Add fixity keywords to haskell's highlights.scm --- runtime/queries/haskell/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index 3f5d6de50096..5009f3b5151e 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -94,6 +94,9 @@ "rec" "forall" "∀" + "infix" + "infixl" + "infixr" ] @keyword