[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-ts-mode 575748b9a5 8/8: Indent changes to comment,
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-ts-mode 575748b9a5 8/8: Indent changes to comment, case, infix |
Date: |
Mon, 16 Sep 2024 10:00:13 -0400 (EDT) |
branch: elpa/haskell-ts-mode
commit 575748b9a55d0043c22cd1f2ae5baab5f9166313
Author: pranshu sharma <pranshu@pebl>
Commit: pranshu sharma <pranshu@pebl>
Indent changes to comment, case, infix
Changed prioritoes of comment and infix, and fixed alternative scinairo for
cases.
---
haskell-ts-mode.el | 43 +++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el
index ad75125643..0ebc2d10e5 100644
--- a/haskell-ts-mode.el
+++ b/haskell-ts-mode.el
@@ -186,26 +186,13 @@
(parent-first-child (lambda (_ parent _)
(treesit-node-start (treesit-node-child parent
0)))))
`((haskell
- ((node-is "comment")
- ;; Indenting comments by priorites:
- ;; 1. next relevent sibling if exists
- ;; 2. previous relevent sibling if exists
- ;; 3. parent
- ;; (relevent means type not it haskell-ts--ignore-types)
- (lambda (node parent _)
- (if-let ((next-sib (funcall ,p-sib node nil)))
- (treesit-node-start next-sib)
- (if-let ((prev-sib (funcall ,p-prev-sib node nil nil)))
- prev-sib
- (treesit-node-start parent))))
- 0)
((node-is "cpp") column-0 0)
((parent-is "comment") column-0 0)
((parent-is "haddock") column-0 0)
((parent-is "imports") column-0 0)
;; Infix
- ((node-is "infix") standalone-parent 1)
((parent-is "infix") ,parent-first-child 0)
+ ((node-is "infix") standalone-parent 1)
;; Lambda
((parent-is "lambda") standalone-parent 2)
@@ -235,10 +222,6 @@
3)
((parent-is "do") ,p-prev-sib 0)
- ((node-is "alternatives")
- (lambda (_ b _)
- (treesit-node-start (treesit-node-child b 0)))
- 4)
((parent-is "alternatives") ,p-prev-sib 0)
;; prev-adaptive-prefix is broken sometimes
@@ -258,12 +241,13 @@
(while (string= "comment" (treesit-node-type n))
(setq n (treesit-node-prev-sibling n)))
(string= "where" (treesit-node-type n))))
+
(lambda (_ b _)
(+ 1 (treesit-node-start (treesit-node-prev-sibling b))))
3)
((parent-is "local_binds\\|instance_declarations") ,p-prev-sib 0)
((node-is "^where$") parent 2)
-
+
;; Match
((lambda (node _ _)
(and (string= "match" (treesit-node-type node))
@@ -280,9 +264,24 @@
(lambda (_ b _) (treesit-node-start (treesit-node-prev-sibling b)))
0)
((n-p-gp nil "signature" "foreign_import") grand-parent 3)
-
- ((parent-is "case") haskell-ts--stand-alone-parent 4)
-
+ ((parent-is "case") standalone-parent 4)
+ ((node-is "alternatives")
+ (lambda (_ b _)
+ (treesit-node-start (treesit-node-child b 0)))
+ 2)
+ ((node-is "comment")
+ ;; Indenting comments by priorites:
+ ;; 1. next relevent sibling if exists
+ ;; 2. previous relevent sibling if exists
+ ;; 3. parent
+ ;; (relevent means type not it haskell-ts--ignore-types)
+ (lambda (node parent _)
+ (if-let ((next-sib (funcall ,p-sib node nil)))
+ (treesit-node-start next-sib)
+ (if-let ((prev-sib (funcall ,p-prev-sib node nil nil)))
+ prev-sib
+ (treesit-node-start parent))))
+ 0)
;; Backup
(catch-all parent 2)))))
- [nongnu] elpa/haskell-ts-mode updated (bf632cba27 -> 575748b9a5), ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode ef35522e99 5/8: Fixed indent for (parent-is "match") scinario, ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode 739415d37d 1/8: Indent fixes(just for consistancy), ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode 59b146204b 6/8: Fixed indent of ']', ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode 2280feefe6 3/8: Comment fixed, ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode 575748b9a5 8/8: Indent changes to comment, case, infix,
ELPA Syncer <=
- [nongnu] elpa/haskell-ts-mode a2b07815bc 2/8: shortening statmenet, ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode cf0c9c308c 4/8: Changed indentation of infix, ELPA Syncer, 2024/09/16
- [nongnu] elpa/haskell-ts-mode eea9607a42 7/8: Forgot defvar + indent of case fixed, ELPA Syncer, 2024/09/16