[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 2c6c772 150/385: better WLDO indentation
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 2c6c772 150/385: better WLDO indentation |
Date: |
Tue, 5 Oct 2021 23:59:20 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 2c6c772df32442060a9cf5f7fe88a1ec8b0635c9
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
better WLDO indentation
---
haskell-tng-smie.el | 14 ++++++++++++--
test/src/indentation.hs | 9 +++++----
test/src/indentation.hs.append.indent | 20 +++++++++++---------
test/src/indentation.hs.insert.indent | 22 ++++++++++++----------
test/src/indentation.hs.layout | 11 ++++++-----
test/src/indentation.hs.lexer | 7 ++++---
test/src/indentation.hs.reindent | 24 +++++++++++++-----------
test/src/indentation.hs.sexps | 11 ++++++-----
8 files changed, 69 insertions(+), 49 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 931283e..1ed75d7 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -168,8 +168,18 @@ information, to aid in the creation of new rules."
(:before
(pcase arg
- ;; encourages WLDOs to move to the left
- ((or "{" "where" "do" "case") (smie-rule-parent))
+ ;; first entries in a WLDO should aim to have the smallest indentation
+ ;; possible. i.e. prefer
+ ;;
+ ;; blah = bloo where
+ ;; bloo = blu
+ ;;
+ ;; not
+ ;;
+ ;; blah = bloo where
+ ;; bloo = blu
+ ((or "{" "where" "let" "do" "case")
+ (smie-rule-parent))
))
))
diff --git a/test/src/indentation.hs b/test/src/indentation.hs
index 556ec8c..278ad20 100644
--- a/test/src/indentation.hs
+++ b/test/src/indentation.hs
@@ -41,10 +41,11 @@ nested_where a b = foo a b
gaz a = blah -- indented
faz = blah -- same level as gaz
-let_in a b = let blah = bloo
- wobble _ = fish
- in
- flibble blah
+let_in a b = let
+ blah = bloo
+ wobble _ = fish
+ in
+ flibble blah
case_of wibble = case wibble of
Nothing -> ""
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index 7f0072e..d5af495 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -84,16 +84,18 @@ v
1 2 v
1 2 v
-let_in a b = let blah = bloo
-1 v
- wobble _ = fish
-1 v
- in
-2 1 v 3
- flibble blah
-v 2 1 3
+let_in a b = let
+1 v
+ blah = bloo
+1 v
+ wobble _ = fish
+1 v
+ in
+2 1 v
+ flibble blah
+2 v 1
-v 1 2 3
+1 v 2
case_of wibble = case wibble of
1 v
Nothing -> ""
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index c1bd0e3..1f01887 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -83,17 +83,19 @@ nested_where a b = foo a b
faz = blah -- same level as gaz
1 2 v
-2 3 v 1
-let_in a b = let blah = bloo
-1 v
- wobble _ = fish
-2 1 v
- in
-2 1 v 3
- flibble blah
-v 2 1 3
+1 2 v
+let_in a b = let
+1 v
+ blah = bloo
+1 v
+ wobble _ = fish
+1 v
+ in
+2 1 v
+ flibble blah
+2 v 1
-v 1 2 3
+1 v 2
case_of wibble = case wibble of
1 v
Nothing -> ""
diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout
index 79a7f3c..f4b88aa 100644
--- a/test/src/indentation.hs.layout
+++ b/test/src/indentation.hs.layout
@@ -41,12 +41,13 @@ module Indentation where
{gaz a = blah -- indented
;faz = blah -- same level as gaz
-}};let_in a b = let {blah = bloo
- ;wobble _ = fish
- }in
- flibble blah
+}};let_in a b = let
+ {blah = bloo
+ ;wobble _ = fish
+ ;in
+ flibble blah
-;case_of wibble = case wibble of
+};case_of wibble = case wibble of
{Nothing -> ""
;Just fish -> fish
diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer
index 98e2525..e08c25a 100644
--- a/test/src/indentation.hs.lexer
+++ b/test/src/indentation.hs.lexer
@@ -41,12 +41,13 @@ where
{ VARID VARID = VARID
; VARID = VARID
-} } ; VARID VARID VARID = let { VARID = VARID
+} } ; VARID VARID VARID = let
+{ VARID = VARID
; VARID _ = VARID
-} in
+; in
VARID VARID
-; VARID VARID = case VARID of
+} ; VARID VARID = case VARID of
{ CONID -> ยง
; CONID VARID -> VARID
diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent
index a46a957..37a2177 100644
--- a/test/src/indentation.hs.reindent
+++ b/test/src/indentation.hs.reindent
@@ -82,19 +82,21 @@ v 1
gaz a = blah -- indented
v 2 1
faz = blah -- same level as gaz
-2 3 v 1
+1 2 v
-v 2 3 1
-let_in a b = let blah = bloo
-v 2 1
- wobble _ = fish
-v 2 1
- in
-2 1 v 3
- flibble blah
-v 2 1 3
+v 1 2 3
+let_in a b = let
+1 v
+ blah = bloo
+v 1
+ wobble _ = fish
+v 1 2
+ in
+2 1 v
+ flibble blah
+2 v 1
-v 1 2 3 4
+v 1 2
case_of wibble = case wibble of
1 v
Nothing -> ""
diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps
index 005753d..fa270e1 100644
--- a/test/src/indentation.hs.sexps
+++ b/test/src/indentation.hs.sexps
@@ -41,12 +41,13 @@
((gaz) (a) = (blah) -- indented
((faz) = (blah)) -- same level as gaz
-)))(let_in) (a) (b) = (let ((blah) = (bloo)
- ((wobble) (_) = (fish))
- )in)
- (flibble) (blah)
+)))(let_in) (a) (b) = (let
+ (((blah) = (bloo)
+ (((wobble) (_) = (fish))
+ )in)
+ (flibble) (blah)
-((case_of) (wibble) = ((case (wibble) (of)
+)(case_of) (wibble) = ((case (wibble) (of)
((Nothing) -> ("")
((Just) (fish) -> (fish))
- [nongnu] elpa/haskell-tng-mode 1009082 140/385: append indentation test, (continued)
- [nongnu] elpa/haskell-tng-mode 1009082 140/385: append indentation test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 88b17d4 137/385: started indentation rules, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cf22f3a 138/385: simplify indentation testing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode a0f777e 166/385: Revert "duplicate ; tokens to be used as terminators", ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2320b89 167/385: alternative to smie-rules-* in :elem and :list-intro, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 60d8c20 149/385: indent "case of", ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 7f9afd2 159/385: list indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6e70344 165/385: duplicate ; tokens to be used as terminators, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ab5252b 169/385: rearrange alts, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e1aba33 168/385: fix a layout bug in lists and records, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2c6c772 150/385: better WLDO indentation,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 3f54673 155/385: don't fontify toplevel, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 32175c0 158/385: thots, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8c2e3f7 157/385: better symid indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode bc5c827 160/385: tuple indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e0acc42 156/385: better tasty error detection, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode c211672 174/385: indentation for hanging type definition, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ef7f335 171/385: note stack compatibility, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 86bcd98 175/385: constraint indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e1c0f0a 179/385: allow indentation option to be tested, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 1cceb64 182/385: cleaner tests, ELPA Syncer, 2021/10/06