[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 08a3946 163/385: records indentation
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 08a3946 163/385: records indentation |
Date: |
Tue, 5 Oct 2021 23:59:23 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 08a394606dbbdb158a861ed737b5378e73fde41a
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
records indentation
---
haskell-tng-smie.el | 12 ++++++++----
test/haskell-tng-indent-test.el | 2 +-
test/src/indentation.hs | 10 ++++++++++
test/src/indentation.hs.append.indent | 20 ++++++++++++++++++++
test/src/indentation.hs.insert.indent | 20 ++++++++++++++++++++
test/src/indentation.hs.layout | 10 ++++++++++
test/src/indentation.hs.lexer | 10 ++++++++++
test/src/indentation.hs.reindent | 22 +++++++++++++++++++++-
test/src/indentation.hs.sexps | 10 ++++++++++
test/src/indentation.hs.syntax | 10 ++++++++++
10 files changed, 120 insertions(+), 6 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 5e86037..ee622db 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -176,7 +176,10 @@ information, to aid in the creation of new rules."
parent grand)))))
(cond
- ((smie-rule-parent-p "[" "(") ",")
+ ((or (smie-rule-parent-p "[" "(")
+ (and (smie-rule-parent-p "{")
+ (smie-rule-grandparent-p "=")))
+ ",")
((or (smie-rule-parent-p "|")
(and (smie-rule-parent-p "=")
@@ -209,9 +212,10 @@ information, to aid in the creation of new rules."
(:after
(pcase arg
- ((or "let" "do" "of" "=" "in" "->" "\\") 2)
+ ((or "let" "do" "of" "in" "->" "\\") 2)
+ ("=" (when (not (smie-rule-parent-p "data")) 2))
("\\case" 2) ;; LambdaCase
- ("where" (if (smie-rule-parent-p "module") 0 2))
+ ("where" (when (not (smie-rule-parent-p "module")) 2))
((or "[" "(") 2)
("{" (when (not (smie-rule-prev-p
"\\case" ;; LambdaCase
@@ -234,7 +238,7 @@ information, to aid in the creation of new rules."
;;
;; blah = bloo where
;; bloo = blu
- ((or "where" "let" "do" "case" "->" "SYMID")
+ ((or "where" "let" "do" "case" "=" "->" "SYMID")
(smie-rule-parent))
("\\case" ;; LambdaCase
(smie-rule-parent))
diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el
index 7733261..11a14ca 100644
--- a/test/haskell-tng-indent-test.el
+++ b/test/haskell-tng-indent-test.el
@@ -14,9 +14,9 @@
;; FIXME implement more indentation rules
;;
-;; TODO records (resolve WLDO ambiguity)
;; TODO multiline type signatures
;; TODO if/then/else
+;; TODO data: one conid ~> record, multi ~> coproduct
;; Three indentation regression tests are possible:
;;
diff --git a/test/src/indentation.hs b/test/src/indentation.hs
index 488d17e..b2de628 100644
--- a/test/src/indentation.hs
+++ b/test/src/indentation.hs
@@ -77,6 +77,16 @@ data Wibble = Wibble Int
| Wobble Int
| Vibble Int
+data Record1 = Record1 {
+ fieldA :: String
+, fieldB :: String
+}
+
+data Record2 = Record2
+ { fieldA :: String
+ , fieldB :: String
+ }
+
lists1 = [ foo
, bar
, [ blah
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index 8732e21..d1240f4 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -156,6 +156,26 @@ v
1 v
v 1
+data Record1 = Record1 {
+1 v
+ fieldA :: String
+v 1
+, fieldB :: String
+v
+}
+v
+
+v
+data Record2 = Record2
+v
+ { fieldA :: String
+1 v
+ , fieldB :: String
+1 v
+ }
+v 1
+
+v 1
lists1 = [ foo
1 v
, bar
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index 380ef7b..dc63d4c 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -156,6 +156,26 @@ data Wibble = Wibble Int
1 v
v 1
+data Record1 = Record1 {
+1 v
+ fieldA :: String
+1 v
+, fieldB :: String
+v
+}
+v
+
+v
+data Record2 = Record2
+1 2 v
+ { fieldA :: String
+1 v
+ , fieldB :: String
+2 1 v
+ }
+v 1
+
+v 1
lists1 = [ foo
1 v
, bar
diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout
index a85ba62..c181fdf 100644
--- a/test/src/indentation.hs.layout
+++ b/test/src/indentation.hs.layout
@@ -77,6 +77,16 @@ module Indentation where
| Wobble Int
| Vibble Int
+;data Record1 = Record1 {
+ fieldA :: String
+;, fieldB :: String
+;}
+
+;data Record2 = Record2
+ { fieldA :: String
+ , fieldB :: String
+ }
+
;lists1 = [ foo
, bar
, [ blah
diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer
index 97aadd9..b4eddbc 100644
--- a/test/src/indentation.hs.lexer
+++ b/test/src/indentation.hs.lexer
@@ -77,6 +77,16 @@ VARID
| CONID CONID
| CONID CONID
+; data CONID = CONID «
+VARID :: CONID
+; , VARID :: CONID
+; »
+
+; data CONID = CONID
+« VARID :: CONID
+, VARID :: CONID
+»
+
; VARID = « VARID
, VARID
, « VARID
diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent
index 5f54fa1..f764170 100644
--- a/test/src/indentation.hs.reindent
+++ b/test/src/indentation.hs.reindent
@@ -156,7 +156,27 @@ data Wibble = Wibble Int
| Vibble Int
v 1
-v 1 2
+v 1 2
+data Record1 = Record1 {
+1 v
+ fieldA :: String
+v 1
+, fieldB :: String
+v
+}
+v
+
+v 1
+data Record2 = Record2
+1 2 v
+ { fieldA :: String
+1 v
+ , fieldB :: String
+1 v
+ }
+v 1
+
+v 2 1
lists1 = [ foo
1 v
, bar
diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps
index 35c2bcf..e149595 100644
--- a/test/src/indentation.hs.sexps
+++ b/test/src/indentation.hs.sexps
@@ -77,6 +77,16 @@
| (Wobble) (Int)
| (Vibble) (Int)
+(data (Record1) = (Record1) ({
+ (fieldA) (::) (String)
+((, (fieldB) (::) (String))
+)}))
+
+(data (Record2) = (Record2)
+ ({ (fieldA) (::) (String)
+ , (fieldB) (::) (String)
+ }))
+
((lists1) = ([ (foo)
, (bar)
, ([ (blah)
diff --git a/test/src/indentation.hs.syntax b/test/src/indentation.hs.syntax
index ce0322d..4fbb203 100644
--- a/test/src/indentation.hs.syntax
+++ b/test/src/indentation.hs.syntax
@@ -77,6 +77,16 @@ wwww wwwwww _ wwwwww www>
_ wwwwww www>
_ wwwwww www>
>
+wwww wwwwwww _ wwwwwww (>
+ wwwwww __ wwwwww>
+. wwwwww __ wwwwww>
+)>
+>
+wwww wwwwwww _ wwwwwww>
+ ( wwwwww __ wwwwww>
+ . wwwwww __ wwwwww>
+ )>
+>
wwwwww _ ( www>
. www>
. ( wwww>
- [nongnu] elpa/haskell-tng-mode aa9bbb7 216/385: add (broken) test coverage for consyms, (continued)
- [nongnu] elpa/haskell-tng-mode aa9bbb7 216/385: add (broken) test coverage for consyms, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5f423b9 100/385: some alts in the indentation test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 50b53d3 114/385: tng compilation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 36ece6d 117/385: low hanging fruit, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 489e4c9 124/385: document explicit export fontification bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 91a1d08 136/385: creating small scenarios for indentation specs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ec39a64 133/385: improvements to indentation alts and compilation info, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f67557b 142/385: fix a layout corner case, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 20f4091 152/385: support dollars in indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0d5e020 151/385: support LambdaCase, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 08a3946 163/385: records indentation,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 3449847 162/385: no need to special-case dollar, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8b5a4d4 177/385: improve indentation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cb801b4 015/385: moar multiline type search, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode de48840 030/385: multiline import anchors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5c50be0 044/385: remove redundant TODOs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 174c63b 046/385: laying the foundations for SMIE, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 97ce717 058/385: improve the testing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2a2afee 064/385: cache invalidation and tests for layout invalidation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3ca869f 067/385: code reorganisation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0ffb885 071/385: a thought, ELPA Syncer, 2021/10/06