emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-ts-mode ef35522e99 5/8: Fixed indent for (parent-i


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-ts-mode ef35522e99 5/8: Fixed indent for (parent-is "match") scinario
Date: Mon, 16 Sep 2024 10:00:12 -0400 (EDT)

branch: elpa/haskell-ts-mode
commit ef35522e995d89c028c37daba5c2fa84fd004787
Author: pranshu sharma <pranshu@pebl>
Commit: pranshu sharma <pranshu@pebl>

    Fixed indent for (parent-is "match") scinario
    
    Before it used to end up in the catch all fallback
---
 haskell-ts-mode.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el
index 54e8e02de2..e56cafa266 100644
--- a/haskell-ts-mode.el
+++ b/haskell-ts-mode.el
@@ -182,7 +182,9 @@
             n)))
         (p-prev-sib
          (lambda (node _ _) (treesit-node-start (funcall p-sib node t))))
-        (p-n-prev (lambda (node) (funcall p-sib node t))))
+        (p-n-prev (lambda (node) (funcall p-sib node t)))
+        (parent-first-child (lambda (_ parent _)
+                              (treesit-node-start (treesit-node-child parent 
0)))))
     `((haskell
        ((node-is "comment")
        ;; Indenting comments by priorites:
@@ -203,11 +205,7 @@
        ((parent-is "imports") column-0 0)
        ;; Infix
        ((node-is "infix") standalone-parent 1)
-       ((parent-is "infix")
-       ;; Parent's first child
-       (lambda (_ parent _)
-         (treesit-node-start (treesit-node-child parent 0)))
-       0)
+       ((parent-is "infix") ,parent-first-child 0)
        ;; Lambda
        ((parent-is "lambda") standalone-parent 2)
 
@@ -268,9 +266,10 @@
        ;; Match
        ((lambda (node _ _)
          (and (string= "match" (treesit-node-type node))
-              (string= "variable" (treesit-node-type (funcall ,p-n-prev 
node)))))
-       parent 1)
-       ((node-is "match") ,p-prev-sib 0)       
+              (string= "variable" (treesit-node-type (funcall ,p-n-prev 
node))) ))
+       ,parent-first-child 1)
+       ((node-is "match") ,p-prev-sib 0)
+       ((parent-is "match") standalone-parent 2)
        ((parent-is "haskell") column-0 0)
        ((parent-is "declarations") column-0 0)
 
@@ -280,6 +279,8 @@
        (lambda (_ b _) (treesit-node-start (treesit-node-prev-sibling b)))
        0)
        ((n-p-gp nil "signature" "foreign_import") grand-parent 3)
+
+       ((parent-is "case") parent 4)
        
        ;; Backup
        (catch-all parent 2)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]