[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 59354b6 198/385: support hanging type ali
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 59354b6 198/385: support hanging type alignment |
Date: |
Tue, 5 Oct 2021 23:59:30 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 59354b6d831fcb8e8dda28a3fdee5cc728eb6ea4
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
support hanging type alignment
---
haskell-tng-smie.el | 9 ++++++---
test/haskell-tng-indent-test.el | 2 --
test/src/indentation.hs.append.indent | 2 +-
test/src/indentation.hs.insert.indent | 2 +-
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index a3243e9..b5eefbf 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -299,10 +299,12 @@ information, to aid in the creation of new rules."
"\\case" ;; LambdaCase
"where" "let" "do" "of"))))
2)
- ((and "::" (guard (smie-rule-hanging-p)))
+ ("::"
(if haskell-tng-aligntypes
`(column . ,(+ haskell-tng-typelead (current-column)))
haskell-tng-typelead))
+ ((and "=>" (guard (smie-rule-parent-p "::")))
+ (haskell-tng--smie-rule-parent-column 3))
("," (smie-rule-separator method))
((or "SYMID" "CONSYM" "KINDSYM")
(if (smie-rule-hanging-p) 2 (smie-rule-parent)))
@@ -453,13 +455,14 @@ BEFORE is t if the line appears before the indentation."
:backward-token #'haskell-tng--lexer-backward-token)
)
-(defun haskell-tng--smie-rule-parent-column ()
+(defun haskell-tng--smie-rule-parent-column (&optional offset)
"For use inside `smie-rules-function',
use the column indentation as the parent. Note that
`smie-rule-parent' may use relative values."
+ (setq offset (or offset 0))
(save-excursion
(goto-char (cadr (smie-indent--parent)))
- `(column . ,(current-column))))
+ `(column . ,(+ offset (current-column)))))
(defun haskell-tng--smie-ancestors (n)
"A list of the Nth non-{identifier, matched paren, string}
diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el
index 08d0851..6e6d913 100644
--- a/test/haskell-tng-indent-test.el
+++ b/test/haskell-tng-indent-test.el
@@ -14,9 +14,7 @@
;; FIXME implement more indentation rules
;;
-;; TODO multiline type signatures
;; TODO records of functions tests
-;; TODO user config for typesig preference (incompatible versions)
;; TODO ImplicitParams in type signatures (without parens)
;; TODO if/then/else
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index 89c7a34..8252d25 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -273,7 +273,7 @@ types2 :: (Monad m, MemberLogger m)
1 v
types3 :: (Monad m, MonadReader Foo m) =>
-1 v
+1 v
(?log :: HasLogger m) =>
1 v
a -> b -> c
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index 694bb46..13e6dad 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -273,7 +273,7 @@ types2 :: (Monad m, MemberLogger m)
v 1
types3 :: (Monad m, MonadReader Foo m) =>
-2 v 1
+1 v
(?log :: HasLogger m) =>
1 v
a -> b -> c
- [nongnu] elpa/haskell-tng-mode 8f4d7fc 225/385: advice around smartparens workaround, (continued)
- [nongnu] elpa/haskell-tng-mode 8f4d7fc 225/385: advice around smartparens workaround, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4cbf702 205/385: move third party deps to -contrib, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3ff278e 227/385: ability to not continue comments, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode dbcef71 235/385: workaround the env file situation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5892c04 232/385: small things, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 44dc467 248/385: notes on motivation, contributing and collaboration, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6f2b5ee 266/385: font lock CPP, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fdbd0a2 239/385: updates for hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode b2e2c3a 293/385: stop stack from being an asshole, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ee07f6d 172/385: type indentation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 59354b6 198/385: support hanging type alignment,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode a788ab2 209/385: more efficient layout caching, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f7e8040 213/385: = ends a type sig, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fe9d65d 222/385: helper for yatemplates, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode bc93c3d 224/385: very alpha hsinspect support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 658ddb6 251/385: docs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 73a60f5 309/385: cache `which hsinspect` per project, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5707166 365/385: use new ghcflags-provided PATH, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode b1c664b 364/385: allow hsinspect population in the background, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ce17d96 376/385: new hsinspect release, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode eb6b487 357/385: test fqn-at-point and fix a longstanding bug, ELPA Syncer, 2021/10/06