From 01dd7b570a692ca59d34c74806e7fcdd48e60b21 Mon Sep 17 00:00:00 2001 From: Corey Powell Date: Tue, 1 Jun 2021 14:44:03 -0500 Subject: [PATCH] Restored haskell syntax It seems to work --- helix-syntax/languages/tree-sitter-haskell | 1 + helix-syntax/src/lib.rs | 2 +- languages.toml | 9 +++++ runtime/queries/haskell/highlights.scm | 43 ++++++++++++++++++++++ runtime/queries/haskell/locals.scm | 4 ++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 160000 helix-syntax/languages/tree-sitter-haskell create mode 100644 runtime/queries/haskell/highlights.scm create mode 100644 runtime/queries/haskell/locals.scm diff --git a/helix-syntax/languages/tree-sitter-haskell b/helix-syntax/languages/tree-sitter-haskell new file mode 160000 index 000000000..004f2709c --- /dev/null +++ b/helix-syntax/languages/tree-sitter-haskell @@ -0,0 +1 @@ +Subproject commit 004f2709c460d95fbfd1061f8efc98f36e33c03c diff --git a/helix-syntax/src/lib.rs b/helix-syntax/src/lib.rs index bb0b2ec60..b923de957 100644 --- a/helix-syntax/src/lib.rs +++ b/helix-syntax/src/lib.rs @@ -74,7 +74,7 @@ macro_rules! mk_langs { (Css, tree_sitter_css), (Elixir, tree_sitter_elixir), (Go, tree_sitter_go), - // (Haskell, tree_sitter_haskell), + (Haskell, tree_sitter_haskell), (Html, tree_sitter_html), (Java, tree_sitter_java), (Javascript, tree_sitter_javascript), diff --git a/languages.toml b/languages.toml index 143a7c278..e13184c91 100644 --- a/languages.toml +++ b/languages.toml @@ -144,3 +144,12 @@ file-types = ["php"] roots = [] indent = { tab-width = 2, unit = " " } + +[[language]] +name = "haskell" +scope = "source.haskell" +injection-regex = "haskell" +file-types = ["hs"] +roots = [] + +indent = { tab-width = 2, unit = " " } diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm new file mode 100644 index 000000000..ecaa2d2cd --- /dev/null +++ b/runtime/queries/haskell/highlights.scm @@ -0,0 +1,43 @@ +(variable) @variable +(operator) @operator +(exp_name (constructor) @constructor) +(constructor_operator) @operator +(module) @module_name +(type) @type +(type) @class +(constructor) @constructor +(pragma) @pragma +(comment) @comment +(signature name: (variable) @fun_type_name) +(function name: (variable) @fun_name) +(constraint class: (class_name (type)) @class) +(class (class_head class: (class_name (type)) @class)) +(instance (instance_head class: (class_name (type)) @class)) +(integer) @literal +(exp_literal (float)) @literal +(char) @literal +(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 +"(" @paren +")" @paren diff --git a/runtime/queries/haskell/locals.scm b/runtime/queries/haskell/locals.scm new file mode 100644 index 000000000..ad67fe43f --- /dev/null +++ b/runtime/queries/haskell/locals.scm @@ -0,0 +1,4 @@ +(signature name: (variable)) @local.definition +(function name: (variable)) @local.definition +(pat_name (variable)) @local.definition +(exp_name (variable)) @local.reference