emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode e1aba33 168/385: fix a layout bug in list


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode e1aba33 168/385: fix a layout bug in lists and records
Date: Tue, 5 Oct 2021 23:59:24 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit e1aba33018735a48ff66f8f86eacd89050eec42c
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    fix a layout bug in lists and records
---
 haskell-tng-layout.el                 | 12 +++---------
 test/src/indentation.hs.insert.indent |  6 +++---
 test/src/indentation.hs.layout        | 12 ++++++------
 test/src/indentation.hs.lexer         | 12 ++++++------
 test/src/indentation.hs.sexps         | 12 ++++++------
 5 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/haskell-tng-layout.el b/haskell-tng-layout.el
index bdedb2f..3517708 100644
--- a/haskell-tng-layout.el
+++ b/haskell-tng-layout.el
@@ -36,14 +36,6 @@
 
 (require 'haskell-tng-util)
 
-;; FIXME incorrect layout for brackets near the edge, don't add semis for 
commas
-;; and parens.
-;;
-;; ;data Record1 = Record1 {
-;;   fieldA :: String
-;; ;, fieldB :: String
-;; ;}
-
 ;; Easiest cache... full buffer parse with full invalidation on any insertion.
 ;;
 ;; A list of (OPEN . (CLOSE . SEPS)) positions, one per inferred block.
@@ -132,7 +124,9 @@ WLDO that is using the offside rule."
                       (forward-line)
                       (forward-comment (point-max))
                       (when (and (= (current-column) level)
-                                 (not (eobp)))
+                                 (not (eobp))
+                                 (not (looking-at
+                                       (rx bol (or "," ")" "]" "}")))))
                         (push (point) seps))
                       (when (< limit (point))
                         (throw 'closed limit))
diff --git a/test/src/indentation.hs.insert.indent 
b/test/src/indentation.hs.insert.indent
index 5be54f3..1cd66ca 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -159,7 +159,7 @@ v           1
 data Record1 = Record1 {
 1 v
   fieldA :: String
-1 v
+v 1
 , fieldB :: String
 v
 }
@@ -193,7 +193,7 @@ v        1 2
 lists2 = [
 1 v
   foo
-1 v
+v 1
 , bar
 v
 ]
@@ -223,7 +223,7 @@ v         1 2
 tuples2 = (
 1 v
   foo
-1 v
+v 1
 , bar
 v
 )
diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout
index c181fdf..7e363b8 100644
--- a/test/src/indentation.hs.layout
+++ b/test/src/indentation.hs.layout
@@ -79,8 +79,8 @@ module Indentation where
 
 ;data Record1 = Record1 {
   fieldA :: String
-;, fieldB :: String
-;}
+, fieldB :: String
+}
 
 ;data Record2 = Record2
   { fieldA :: String
@@ -96,8 +96,8 @@ module Indentation where
 
 ;lists2 = [
   foo
-;, bar
-;]
+, bar
+]
 
 ;lists3 = [ foo ,
            bar ]
@@ -111,8 +111,8 @@ module Indentation where
 
 ;tuples2 = (
   foo
-;, bar
-;)
+, bar
+)
 
 ;tuples3 = ( foo ,
             bar )
diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer
index b4eddbc..16bbe91 100644
--- a/test/src/indentation.hs.lexer
+++ b/test/src/indentation.hs.lexer
@@ -79,8 +79,8 @@ VARID
 
 ; data CONID = CONID «
 VARID :: CONID
-; , VARID :: CONID
-; »
+, VARID :: CONID
+»
 
 ; data CONID = CONID
 « VARID :: CONID
@@ -96,8 +96,8 @@ VARID :: CONID
 
 ; VARID = «
 VARID
-; , VARID
-; »
+, VARID
+»
 
 ; VARID = « VARID ,
 VARID »
@@ -111,8 +111,8 @@ VARID »
 
 ; VARID = «
 VARID
-; , VARID
-; »
+, VARID
+»
 
 ; VARID = « VARID ,
 VARID »
diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps
index e149595..952103e 100644
--- a/test/src/indentation.hs.sexps
+++ b/test/src/indentation.hs.sexps
@@ -79,8 +79,8 @@
 
 (data (Record1) = (Record1) ({
   (fieldA) (::) (String)
-((, (fieldB) (::) (String))
-)}))
+, (fieldB) (::) (String)
+}))
 
 (data (Record2) = (Record2)
   ({ (fieldA) (::) (String)
@@ -96,8 +96,8 @@
 
 ((lists2) = ([
   (foo)
-((, (bar))
-)]))
+, (bar)
+]))
 
 ((lists3) = ([ (foo) ,
            (bar) ]))
@@ -111,8 +111,8 @@
 
 ((tuples2) = (
   (foo)
-((, (bar))
-)))
+, (bar)
+))
 
 ((tuples3) = ( (foo) ,
             (bar) ))))))))))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]