branch: elpa/haskell-ts-mode
commit 75ea1a045411dd8c329257e4c3e8761ab281e525
Author: pranshu <pranshusharma...@gmail.com>
Commit: pranshu <pranshusharma...@gmail.com>

    Fixed more indent
    
    Now indent does not change AST, tested using ghc
---
 haskell-ts-mode.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el
index 74dbcdef43..2c965cd52a 100644
--- a/haskell-ts-mode.el
+++ b/haskell-ts-mode.el
@@ -154,9 +154,12 @@
        ;; Lambda
        ((parent-is "lambda") standalone-parent 2)
 
+       ((parent-is "class_declarations") prev-sibling 0)
+       ;; ((lambda (a b c) (message (treesit-node-type b)) nil))
+       
        ;; in
        ((node-is "^in$") parent 0)
-       
+     
        ;; list
        ((node-is "]") parent 0)
        ((parent-is "list") parent 1)
@@ -185,7 +188,7 @@
        (no-node prev-adaptive-prefix 0)
        
        ((parent-is "data_constructors") parent 0)
-
+     
        ;; where
        ((lambda (node _ _)
          (let ((n (treesit-node-prev-sibling node)))
@@ -230,7 +233,7 @@
        ((parent-is "haskell") column-0 0)
        ((parent-is "declarations") column-0 0)
 
-       ((parent-is "record") grand-parent 0)
+       ((parent-is "record") standalone-parent 2)
 
        ((parent-is "exports")
        (lambda (_ b _) (treesit-node-start (treesit-node-prev-sibling b)))
@@ -295,7 +298,7 @@
   (interactive "d")
   (let ((node (treesit-node-at pos)))
     (while (not (string-match
-                "declarations\\|haskell"
+                "^declarations$\\|haskell"
                 (treesit-node-type (treesit-node-parent node))))
       (setq node (treesit-node-parent node)))
     (indent-region (treesit-node-start node) (treesit-node-end node))))

Reply via email to