[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 64ec84d 260/385: if/then/else indentation
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 64ec84d 260/385: if/then/else indentation |
Date: |
Tue, 5 Oct 2021 23:59:43 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 64ec84d7170600ddca96b5ee91cf953f2fd367a5
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
if/then/else indentation
---
haskell-tng-smie.el | 4 ++++
test/haskell-tng-indent-test.el | 1 -
test/src/indentation.hs | 12 ++++++++++--
test/src/indentation.hs.append.indent | 20 ++++++++++++++++++--
test/src/indentation.hs.faceup | 12 ++++++++++--
test/src/indentation.hs.imenu | 27 ++++++++++++++-------------
test/src/indentation.hs.insert.indent | 24 ++++++++++++++++++++----
test/src/indentation.hs.layout | 12 ++++++++++--
test/src/indentation.hs.sexps | 14 +++++++++++---
test/src/indentation.hs.syntax | 10 +++++++++-
10 files changed, 106 insertions(+), 30 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index ec65586..2348d07 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -265,6 +265,9 @@ information, to aid in the creation of new rules."
(cl-search '("{" "=") ancestors :test 'equal))
",")
+ ((member next '("then" "else"))
+ next)
+
((or (equal parent "|")
(and (equal parent "=")
(equal grand "data")
@@ -324,6 +327,7 @@ information, to aid in the creation of new rules."
((and "=>" (guard (smie-rule-parent-p "::")))
(haskell-tng--smie-rule-parent-column 3))
("," (smie-rule-separator method))
+ ((or "if" "then" "else") 2)
((or "SYMID" "CONSYM" "KINDSYM")
(if (smie-rule-hanging-p) 2 (smie-rule-parent)))
))
diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el
index f5f5ac2..6433333 100644
--- a/test/haskell-tng-indent-test.el
+++ b/test/haskell-tng-indent-test.el
@@ -15,7 +15,6 @@
;; TODO line after `instance ... where' has too much indent
;; TODO records assigning / copy by label
;; TODO records of functions
-;; TODO if/then/else
;; TODO ImplicitParams in type signatures (without parens)
;; Three indentation regression tests are possible:
diff --git a/test/src/indentation.hs b/test/src/indentation.hs
index 5cad1cf..7429bd1 100644
--- a/test/src/indentation.hs
+++ b/test/src/indentation.hs
@@ -73,11 +73,19 @@ not_dollars = do
shouldGoHere <$>
here
-logic a =
+logic1 a =
if a > 0
- then a
+ then b
else -a
+logic2 a =
+ if
+ a > 0
+ then
+ b
+ else
+ -a
+
data Wibble = Wibble Int
| Wobble Int
| Vibble Int
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index b64a416..7df019e 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -148,16 +148,32 @@ not_dollars = do
2 v 1 3
1 v 2 3
-logic a =
+logic1 a =
1 v
if a > 0
1 v
- then a
+ then b
1 v
else -a
1 v
1 v
+logic2 a =
+1 v
+ if
+2 1 v
+ a > 0
+2 v 1
+ then
+2 1 v
+ b
+2 v 1
+ else
+2 1 v
+ -a
+1 2 v
+
+1 2 v
data Wibble = Wibble Int
1 v
| Wobble Int
diff --git a/test/src/indentation.hs.faceup b/test/src/indentation.hs.faceup
index d75a2d6..8975357 100644
--- a/test/src/indentation.hs.faceup
+++ b/test/src/indentation.hs.faceup
@@ -73,11 +73,19 @@ not_dollars «:haskell-tng-keyword-face:=»
«:haskell-tng-keyword-face:do»
shouldGoHere <$>
here
-logic a «:haskell-tng-keyword-face:=»
+logic1 a «:haskell-tng-keyword-face:=»
«:haskell-tng-keyword-face:if» a > 0
- «:haskell-tng-keyword-face:then» a
+ «:haskell-tng-keyword-face:then» b
«:haskell-tng-keyword-face:else» -a
+logic2 a «:haskell-tng-keyword-face:=»
+ «:haskell-tng-keyword-face:if»
+ a > 0
+ «:haskell-tng-keyword-face:then»
+ b
+ «:haskell-tng-keyword-face:else»
+ -a
+
«:haskell-tng-keyword-face:data»«:haskell-tng-type-face: Wibble
»«:haskell-tng-keyword-face:=» «:haskell-tng-conid-face:Wibble»
«:haskell-tng-conid-face:Int»
«:haskell-tng-keyword-face:|» «:haskell-tng-conid-face:Wobble»
«:haskell-tng-conid-face:Int»
«:haskell-tng-keyword-face:|» «:haskell-tng-conid-face:Vibble»
«:haskell-tng-conid-face:Int»
diff --git a/test/src/indentation.hs.imenu b/test/src/indentation.hs.imenu
index d9d65e3..19788fa 100644
--- a/test/src/indentation.hs.imenu
+++ b/test/src/indentation.hs.imenu
@@ -10,16 +10,17 @@
("lambda_case" . 1481)
("dollars" . 1540)
("not_dollars" . 1613)
- ("logic" . 1689)
- ("lists1" . 2061)
- ("lists2" . 2159)
- ("lists3" . 2185)
- ("tuples1" . 2220)
- ("tuples2" . 2324)
- ("tuples3" . 2351)
- ("typesig" . 2388)
- ("types1" . 2412)
- ("types2" . 2457)
- ("types2b" . 2515)
- ("types3" . 2576)
- ("types_short" . 2676))
+ ("logic1" . 1689)
+ ("logic2" . 1731)
+ ("lists1" . 2116)
+ ("lists2" . 2214)
+ ("lists3" . 2240)
+ ("tuples1" . 2275)
+ ("tuples2" . 2379)
+ ("tuples3" . 2406)
+ ("typesig" . 2443)
+ ("types1" . 2467)
+ ("types2" . 2512)
+ ("types2b" . 2570)
+ ("types3" . 2631)
+ ("types_short" . 2731))
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index 66a7abb..b0919ee 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -148,16 +148,32 @@ not_dollars = do
2 v 1 3
v 1 2 3
-logic a =
+logic1 a =
1 v
if a > 0
-2 1 v
- then a
-2 1 v
+1 v
+ then b
+1 v
else -a
1 v
v 1
+logic2 a =
+1 v
+ if
+2 1 v
+ a > 0
+2 v 1
+ then
+2 1 v
+ b
+2 v 1
+ else
+2 1 v
+ -a
+1 2 v
+
+v 1 2
data Wibble = Wibble Int
1 v
| Wobble Int
diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout
index b3b3718..d975bbf 100644
--- a/test/src/indentation.hs.layout
+++ b/test/src/indentation.hs.layout
@@ -73,11 +73,19 @@ module Indentation where
;shouldGoHere <$>
here
-};logic a =
+};logic1 a =
if a > 0
- then a
+ then b
else -a
+;logic2 a =
+ if
+ a > 0
+ then
+ b
+ else
+ -a
+
;data Wibble = Wibble Int
| Wobble Int
| Vibble Int
diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps
index 6a42b01..1e6be1e 100644
--- a/test/src/indentation.hs.sexps
+++ b/test/src/indentation.hs.sexps
@@ -73,11 +73,19 @@
((shouldGoHere) <$>
(here))
-)(logic) (a) =
+)(logic1) (a) =
(if (a) > (((0)
- (then) (a)
+ (then) (b)
(else) (-(a)
+((logic2) (a) =
+ (if
+ (a) > (((0)
+ (then)
+ (b)
+ (else)
+ (-(a)
+
(data (Wibble) = (Wibble) (Int)
| (Wobble) (Int)
| (Vibble) (Int))
@@ -150,5 +158,5 @@
((?log) :: (HasLogger) (m)) =>
(a) -> (b) -> (c))
-((types_short) :: (Foo) -> (Bar))))))))))))))))))
+((types_short) :: (Foo) -> (Bar)))))))))))))))))))))))
)))
\ No newline at end of file
diff --git a/test/src/indentation.hs.syntax b/test/src/indentation.hs.syntax
index 594b67d..94efffd 100644
--- a/test/src/indentation.hs.syntax
+++ b/test/src/indentation.hs.syntax
@@ -73,11 +73,19 @@ wwwwwwwwwww _ ww>
wwwwwwwwwwww ___>
wwww>
>
-wwwww w _>
+wwwwww w _>
ww w _ w>
wwww w>
wwww _w>
>
+wwwwww w _>
+ ww>
+ w _ w>
+ wwww>
+ w>
+ wwww>
+ _w>
+>
wwww wwwwww _ wwwwww www>
_ wwwwww www>
_ wwwwww www>
- [nongnu] elpa/haskell-tng-mode 083e80a 110/385: assert on alternative indentation order, (continued)
- [nongnu] elpa/haskell-tng-mode 083e80a 110/385: assert on alternative indentation order, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ec1ac46 361/385: document a bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4b598b2 377/385: third party tools use project specific PATH, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode aaf7c55 370/385: support for hsinspect-lsp, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode b3e6c9a 113/385: compilation mode regression tests vs haskell-mode, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 99a7f10 337/385: cleanup, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e6d8761 343/385: local jump-to-definition should error, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode c31afdb 272/385: missing CPP case, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 85c4dd5 233/385: fix bugfix in goto-import, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5c157fb 255/385: rigid ormolu support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 64ec84d 260/385: if/then/else indentation,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 1d53572 243/385: bugfixes, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode d1e599a 285/385: switch formatting backend based on project config, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fd06b8f 264/385: move haskell-tng-newline into the -extra package, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8ff79e7 247/385: allow parallelism, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4e2cf00 284/385: simplify the installation of hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 1107e63 274/385: bump hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8475578 311/385: typos, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f8d2b91 295/385: miss some false positive ghc errors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fca5c6e 315/385: better docs and cabal-install support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode b2e19c9 318/385: document next steps, ELPA Syncer, 2021/10/06