branch: elpa/haskell-ts-mode commit 155bf7986730eefa42abb6640b65b2777a4c117b Author: Pranshu Sharma <pranshusharma...@gmail.com> Commit: Pranshu Sharma <pranshusharma...@gmail.com>
more indent fixes --- README.org | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- haskell-ts-mode.el | 17 +++++++++++++---- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index 4cd1ddc5e8..8bca07d764 100644 --- a/README.org +++ b/README.org @@ -33,8 +33,6 @@ The more interesting features are: cyclical way, it cycles through where you might want indentation. haskell-ts-mode, meanwhile relies on you to set the parse tree changing whitespace. -- Significantly more perfomant than haskell(-tng)-mode, don't have a - number on this yet. * Motivation @@ -50,6 +48,55 @@ very complex and required a web of dependencies. Both these modes ended up practically parsing haskells syntax to implement indentation, so I thought why not use tree sitter? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + However, haskell(-tng)-mode is still a lot more complete than this, and is recommended if you have any commercial work to do. diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el index 267ca6d70a..ad8beba5f8 100644 --- a/haskell-ts-mode.el +++ b/haskell-ts-mode.el @@ -98,10 +98,12 @@ (match ("->" @font-lock-doc-face))) :language 'haskell :feature 'comment - `(((comment) @font-lock-comment-face)) + `(((comment) @font-lock-comment-face) + ((haddock) @font-lock-doc-face)) :language 'haskell :feature 'pragma - `((pragma) @font-lock-preprocessor-face) + `((pragma) @font-lock-preprocessor-face + (cpp) @font-lock-preprocessor-face) :language 'haskell :feature 'str :override t @@ -119,10 +121,11 @@ (treesit-node-start n))))) `((haskell ((node-is "comment") column-0 0) + ((parent-is "comment") column-0 0) ((parent-is "imports") column-0 0) ;; Infix ((parent-is "infix") parent 0) - ((node-is "infix") grand-parent 2) + ((node-is "infix") standalone-parent 2) ;; list ((node-is "]") parent 0) @@ -133,8 +136,9 @@ ((node-is "^else$") parent 2) ((node-is "^in$") parent 2) - + ((parent-is "apply") parent -1) + ((node-is "quasiquote") grand-parent 2) ((parent-is "quasiquote_body") (lambda (a b c) c) 0) ;; Do Hg ((lambda (node parent bol) @@ -196,6 +200,11 @@ ((parent-is "declarations") column-0 0) ((parent-is "record") grand-parent 0) + + ((parent-is "exports") + (lambda (a b c) (treesit-node-start (treesit-node-prev-sibling b))) + 0) + ((n-p-gp nil "signature" "foreign_import") grand-parent 3) ;; Backup (catch-all parent 2)