[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 4b0ab71 199/385: indent type signatures o
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 4b0ab71 199/385: indent type signatures on separate lines |
Date: |
Tue, 5 Oct 2021 23:59:31 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 4b0ab715f1168459d2454caeac13285f3b31af7e
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
indent type signatures on separate lines
---
haskell-tng-smie.el | 15 ++++++++++++++-
test/src/indentation.hs | 6 ++++++
test/src/indentation.hs.append.indent | 12 ++++++++++++
test/src/indentation.hs.insert.indent | 12 ++++++++++++
4 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index b5eefbf..081b7f4 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -263,6 +263,10 @@ information, to aid in the creation of new rules."
(< (--count (equal it "=>") prevline) 2))
"=>")
+ ((haskell-tng--smie-search-prev-line
+ (concat "^" haskell-tng--rx-c-varid "$"))
+ "::")
+
((equal parent "deriving")
";")
@@ -492,10 +496,19 @@ Inspired by `smie-indent--parent', which can only be used
in
(let ((eol (line-end-position))
tokens)
(while (< (point) eol)
- (when-let (tok (smie-indent-forward-token))
+ (let ((tok (smie-indent-forward-token)))
+ ;; intentionally include non-tokens
(push (car tok) tokens)))
(reverse tokens))))
+(defun haskell-tng--smie-search-prev-line (regexp)
+ "Search forward on the previous non-empty line"
+ (save-excursion
+ (beginning-of-line)
+ (forward-comment (- (point)))
+ (beginning-of-line)
+ (re-search-forward regexp (line-end-position) t)))
+
;; TODO smie-powered non-indentation features, e.g. sort-list
;; SMIE wishlist, in order of desirability:
diff --git a/test/src/indentation.hs b/test/src/indentation.hs
index c9865cd..89e0541 100644
--- a/test/src/indentation.hs
+++ b/test/src/indentation.hs
@@ -135,6 +135,12 @@ types2 :: (Monad m, MemberLogger m)
-> b
-> c
+types2b
+ :: (Monad m, MemberLogger m)
+ => a
+ -> b
+ -> c
+
types3 :: (Monad m, MonadReader Foo m) =>
(?log :: HasLogger m) =>
a -> b -> c
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index 8252d25..14ee722 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -272,6 +272,18 @@ types2 :: (Monad m, MemberLogger m)
1 v
1 v
+types2b
+1 v
+ :: (Monad m, MemberLogger m)
+1 v
+ => a
+1 v
+ -> b
+1 v
+ -> c
+1 v
+
+1 v
types3 :: (Monad m, MonadReader Foo m) =>
1 v
(?log :: HasLogger m) =>
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index 13e6dad..ea3b0c7 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -272,6 +272,18 @@ types2 :: (Monad m, MemberLogger m)
1 v
v 1
+types2b
+1 v
+ :: (Monad m, MemberLogger m)
+1 v
+ => a
+1 v
+ -> b
+1 v
+ -> c
+1 v
+
+v 1
types3 :: (Monad m, MonadReader Foo m) =>
1 v
(?log :: HasLogger m) =>
- [nongnu] elpa/haskell-tng-mode aa2a0ad 146/385: prefer --enable-tests, (continued)
- [nongnu] elpa/haskell-tng-mode aa2a0ad 146/385: prefer --enable-tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode a754020 144/385: indent alts will suggest based on previous <- lines, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 9023dc6 164/385: don't rely on line-based indentation rules, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fdaaf38 148/385: indent after "in", ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e2c60a9 161/385: prep for records, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8e4f438 184/385: don't continue indenting one liner types, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5251477 186/385: thots, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 41f1ad5 191/385: document fast-tags, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4ec6259 185/385: prefer the lexer, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 1475f31 196/385: workaround bad indentation at the end of files, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4b0ab71 199/385: indent type signatures on separate lines,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 950d094 210/385: projectile is not core, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2df165a 229/385: electric indent locally disabled only, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 56ee2aa 231/385: completions alpha, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6e938d0 230/385: workaround cabal bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 444664d 257/385: special case indentation of visual line breaks, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 487989b 241/385: skeleton for contrib-stack, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cea8b23 240/385: proof of concept getting the ghcflags from cabal, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6699829 277/385: cleaner fqns, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0abe075 246/385: only create ghcflags for relative dirs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2cfae9e 276/385: bump hsinspect, ELPA Syncer, 2021/10/06