README.org
changeset 2 9272314a1c65
parent 0 4d355b59e2a3
--- a/README.org	Thu Dec 12 23:05:57 2024 +1000
+++ b/README.org	Thu Dec 12 23:29:55 2024 +1000
@@ -1,3 +1,5 @@
+#+title: haskell-ts-mode
+#+author: Pranshu Sharma
 
 * haskell-ts-mode
 
@@ -7,16 +9,21 @@
 
 [[./ss.png]]
 
-The above screenshot is indented coloured using haskell-ts-mode, with
-prettify-symbols-mode enabled.
+The above screenshot is indented and coloured using haskell-ts-mode,
+with =prettify-symbols-mode= enabled.
 
 * Usage
 
 =C-c C-r= to open REPL
 =C-c C-c= to send code to repl
-=C-M-q=   Indent paragraph
+=C-M-q=   Indent the function
 
 * Features
+
+say it with me: indentation does not change the syntax-tree.  This
+means that the indenation is a lot more predictable, but sometimes you
+must manually press M-i to indent.
+
 an overview of the features are:
 - Syntax highliting
 - Indentation
@@ -28,19 +35,13 @@
 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, as it is the only
+    in =f (_:(a:[]))= only =a= is highlighted, as it is the only
     variable that is captured that can be used in body of function
   - 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, 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
@@ -49,12 +50,12 @@
 
 * Motivation
   
-haskell-mode contains nearly 30k lines of code, and is
+=haskell-mode= contains nearly 30k lines of code, and is
 about 30 years old.  Therefore, a lot of stuff emacs has gained the
 ability to do in those years, haskell-mode already has implemented
 them.
 
-In 2018, a mode called haskell-tng-mode was made to solve some of
+In 2018, a mode called =haskell-tng-mode= was made to solve some of
 these problems. However because of haskell's syntax, it too became
 very complex and required a web of dependencies.
 
@@ -74,7 +75,7 @@
 * Customization
 
 If colour is too much or too less for you, adjust
-treesit-font-lock-level accordingly.
+=treesit-font-lock-level= accordingly.
 
 If you want to highlight signature declarations (disabled by default),
 add the following to your init file:
@@ -89,7 +90,7 @@
 #+end_src
 
 ** Pretify symbols mode
-prettify symbols mode can be used to replace common symbols with
+=prettify-symbols-mode= can be used to replace common symbols with
 unicode alternatives.
 
 #+begin_src emacs-lisp
@@ -97,23 +98,26 @@
 #+end_src
 
 ** Adjusting font lock level
-set haskell-ts-font-lock-level accordingly.
+set =haskell-ts-font-lock-level= accordingly.  Default value is 4, so if
+you suffer from contagious dehydration, you can lower it.
 
 ** Language server
 
-haskell-ts-mode is compatiable with lsp-haskell.
+=haskell-ts-mode= now works with =lsp-mode=, however =lsp-haskell= still requires on =haskell-mode=.
+
+To add =eglot= support, add the following code to you init.el:
 
-To enable eglot support, use the following code in your init.el:
 #+begin_src emacs-lisp
-(with-eval-after-load 'eglot (haskell-ts-setup-eglot))
+  (with-eval-after-load 'eglot
+    (defvar eglot-server-programs)
+    (add-to-list 'eglot-server-programs
+  	       '(haskell-ts-mode . ("haskell-language-server-wrapper" "--lsp"))))
 #+end_src
 
-* TODO and limitations
+* TODO
 - 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.
+- _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.