branch: elpa/haskell-ts-mode commit 04971e0c4ee0ab8105c2ef48e1c49ac3253f3018 Author: Pranshu Sharma <pranshusharma...@gmail.com> Commit: Pranshu Sharma <pranshusharma...@gmail.com>
Updated ss, added more info in readme --- README.org | 106 ++++++++++++++++++++++++------------------------------------- ss.png | Bin 23881 -> 76449 bytes 2 files changed, 42 insertions(+), 64 deletions(-) diff --git a/README.org b/README.org index 8bca07d764..4d0fab56f0 100644 --- a/README.org +++ b/README.org @@ -3,36 +3,41 @@ A haskell mode that uses treesitter. -The package is still in devlopment, please report bugs or email -them(email found it main .el file). - * Screenshot [[ss.png]] +The above screenshot is indented coloured using haskell-ts-mode, with +prettify-symbols-mode enabled. + * Features -The basic features are: +an overview of the features are: - Syntax highliting - Indentation - Imenu support - REPL - Prettify symbols mode support +* Comparasion with haskell-mode The more interesting features are: - Logical syntax highlighting: - Only arguments that can be used in functions are highlighted, eg in `f (_:(a:[])) only 'a' is highlighted - - The return type of a function is optionally highlighted, if - treesit-font-lock-level is set to 4 + - The return type of a function is highlighted - All new variabels are(or should be) highlighted, this includes generators, lambda args. - highlighting the '=' operaotr in guarded matches correctly, this would be stupidly hard in regexp based syntax - Unlike haskell-mode, quasi quotes are understood and do not confuse - the mode -- Consistant indentation: haskell-mode's indentation works in a - cyclical way, it cycles through where you might want indentation. - haskell-ts-mode, meanwhile relies on you to set the parse tree - changing whitespace. + the mode, thanks to treesitter +- Predictable (but less powerful) indentation: haskell-mode's + indentation works in a cyclical way, it cycles through where you + might want indentation. haskell-ts-mode, meanwhile relies on you to + set the concrete syntax tree changing whitespace. +- More perfomant, this is especially seen in longer files +- Much much less code, haskell mode has accumlated 30,000 lines of + features to do with all things haskell related, this mode just keeps + the scope to basic major mode stuff, and leaves other stuff for + external packages. * Motivation @@ -48,58 +53,6 @@ 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. - * Installation #+BEGIN_SRC: elisp @@ -114,5 +67,30 @@ treesit-font-lock-level accordingly. If that is not enough, you can customize haskell-ts-font-lock-feature-list -* TODO +** how to disable haskell-ts-mode indentation + +#+begin_src: emacs-lisp +(setq haskell-ts-use-indent nil) +#+end_src + +** Pretify symbols mode +prettify symbols mode can be used to replace common symbols with +unicode alternatives. + +#+begin_src: emacs-lisp +(add-hook 'haskell-ts-mode 'prettify-symbols-mode) +#+end_src + +** Adjusting font lock level +set haskell-ts-font-lock-level accordingly. + +* TODO and limitations - support for customization UI +- Imenu support for functions with multiple definitions + +Limitations: _Proper indenting of multiline signatures_: the +treesitter grammer does not flatten the signautes, rather leaves them +to the standard infix interpretatoin. This makes indentation hard, as +it will mean the only way to check if the the signature node is an +ancestor of node at point is to perfom a recursive ascent, which is +horrible for perfomance. diff --git a/ss.png b/ss.png index 4d2a168cc7..03ddc1eb48 100644 Binary files a/ss.png and b/ss.png differ