diff options
| author | elianiva <dicha.arkana03@gmail.com> | 2021-06-19 05:09:06 +0700 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2021-06-26 12:10:52 +0200 |
| commit | f9bce468a0745b50a4800337232b1a413a19e364 (patch) | |
| tree | 6f4c18937a107fe74b4a3335cda2645af85044bb /queries | |
| parent | feat: add haskell highlights (diff) | |
| download | nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.tar nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.tar.gz nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.tar.bz2 nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.tar.lz nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.tar.xz nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.tar.zst nvim-treesitter-f9bce468a0745b50a4800337232b1a413a19e364.zip | |
feat(haskell): improve highlight query
Co-authored-by: Farbod Salamat-Zadeh <12140044+farbodsz@users.noreply.github.com>
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/haskell/highlights.scm | 111 |
1 files changed, 72 insertions, 39 deletions
diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index d999cb8ec..52fd4fbbd 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -1,17 +1,36 @@ +;; ---------------------------------------------------------------------------- +;; Literals and comments + (integer) @number +(exp_negation) @number (exp_literal (float)) @float - (char) @character - (string) @string -(variable) @variable - -(con_unit) @symbol +(con_unit) @symbol ; unit, as in () (comment) @comment -(function name: (variable) @function) +;; ---------------------------------------------------------------------------- +;; Punctuation + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +[ + (comma) + ";" +] @punctuation.delimiter + + +;; ---------------------------------------------------------------------------- +;; Keywords, operators, includes [ "forall" @@ -24,37 +43,39 @@ "if" "then" "else" + "case" + "of" ] @conditional [ - (constructor) - (module) -] @constructor - -;; True or False -((constructor) @_bool (#match? @_bool "(True|False)")) @boolean - -(signature name: (variable) @type) -(constraint class: (class_name (type)) @type) -(class (class_head class: (class_name (type)) @type)) -(instance (instance_head class: (class_name (type)) @type)) - -[ - (type) -] @type + "import" + "qualified" + "module" +] @include [ - (qualified_module) ;; grabs the `.` (dot), ex: import System.IO - (tycon_arrow) (operator) (constructor_operator) + (type_operator) + (tycon_arrow) + (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (all_names) + (wildcard) + "=" + "|" "::" + "=>" + "->" + "<-" + "\\" + "`" + "@" ] @operator -[ - "import" - "module" -] @include +(qualified_module (module) @constructor) +(qualified_type (module) @namespace) +(qualified_variable (module) @namespace) +(import (module) @namespace) [ (where) @@ -66,8 +87,8 @@ "newtype" "family" "type" - "qualified" "as" + "hiding" "deriving" "via" "stock" @@ -77,15 +98,27 @@ "rec" ] @keyword -[ - "(" - ")" - "{" - "}" - "[" - "]" -] @punctuation.bracket -; [ -; "," -; ] @punctuation.delimiter +;; ---------------------------------------------------------------------------- +;; Functions and variables + +(signature name: (variable) @type) +(function name: (variable) @function) + +(variable) @variable +"_" @punctuation.special + +(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)")) @boolean |
