[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 9dc0abc 129/385: alt indentation levels s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 9dc0abc 129/385: alt indentation levels should be ordered |
Date: |
Tue, 5 Oct 2021 23:59:15 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 9dc0abcb48eff76ca8369ce9ae3f62afee4ae40c
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
alt indentation levels should be ordered
---
haskell-tng-smie.el | 11 +++++--
test/src/medley.hs.insert.indent | 64 ++++++++++++++++++++--------------------
2 files changed, 41 insertions(+), 34 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 0e381aa..36778b8 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -146,17 +146,24 @@ current line."
indents)
(when (re-search-backward haskell-tng:regexp:toplevel nil t)
(while (< (line-number-at-pos) the-line)
+ ;; FIXME improve the indentation alts
;; TODO add positions of WLDOS
+ ;; TODO +- 2 WLDOS
;; TODO special cases for import (unless grammar handles it)
;; TODO special cases for multiple whitespaces (implies alignment)
;; TODO the-line +- 2
(push (current-indentation) indents)
(forward-line)))
- ;; indentation of the next line is common for insert edits
+ ;; alts are easier to use when ordered
+ (setq indents (sort indents '<))
+ ;; TODO consider ordering all alts, and cycling the list so the first alt
+ ;; is the next higher than the current indentation level
+
+ ;; indentation of the next line is common for insert edits, top priority
(forward-line)
(forward-comment (point-max))
- (when (not (eq the-line (line-number-at-pos)))
+ (when (/= the-line (line-number-at-pos))
(push (current-indentation) indents))
(-distinct indents))))
diff --git a/test/src/medley.hs.insert.indent b/test/src/medley.hs.insert.indent
index 7d2d4d1..661081d 100644
--- a/test/src/medley.hs.insert.indent
+++ b/test/src/medley.hs.insert.indent
@@ -189,23 +189,23 @@ foo ::
Wibble -- wibble
2v 1
-> Wobble -- wobble
-32 1 v
+23 1 v
-> Wobble -- wobble
-32 1 v
+23 1 v
-> Wobble -- wobble
-32 1 v
+23 1 v
-> (wob :: Wobble)
-32 1 v
+23 1 v
-> (Wobble -- wobble
-32 1 v
+23 1 v
a b c)
-13 2 v
+12 3 v
-v2 1
+v1 2
(foo :: (Wibble Wobble)) foo
-13 2 v
+12 3 v
-v2 1
+v1 2
newtype TestApp
2 1 v
(logger :: TestLogger)
@@ -225,21 +225,21 @@ v
optionsParser = Options
2 1 v
<$> (Opts.flag' Alloc (Opts.long "alloc" <> Opts.help "wibble")
-3 2 1 v
+2 3 1 v
<|> Opts.flag' Entries (Opts.long "entry" <> Opts.help "wobble")
-3 2 1 v
+2 3 1 v
<|> Opts.flag' Bytes (Opts.long "bytes" <> Opts.help "i'm a fish"))
-3 1 2v
+2 1 3v
<*> optional
-3 1 2v
+1 2 3v
(Opts.strArgument
-5 3 42 1 v
+2 3 45 1 v
(Opts.metavar "MY-FILE" <>
-6 4 53 21 v
+2 3 45 61 v
Opts.help "meh"))
-1 4 5v 32
+1 2 3v 45
-1 5 v64 32
+1 2 v34 56
type PhantomThing
1 v
@@ -247,25 +247,25 @@ v
type SomeApi =
2 v 1
"thing" :> Capture "bar" Index :> QueryParam "wibble" Text
-3 2 v 1
+2 3 v 1
:> QueryParam "wobble" Natural
-2 1 v
+1 2 v
:> Header TracingHeader
TracingId
-2 1 v
+1 2 v
:> ThingHeader
-2 1 v
+1 2 v
:> Get '[JSON] (The ReadResult)
-3 1 2 v
+2 1 3 v
:<|> "thing" :> ReqBody '[JSON] Request
-4 v 3 1 2
+2 v 3 1 4
:> Header TracingHeader TracingId
-4 1 3 v 2
+1 2 3 v 4
:> SpecialHeader
-4 1 3 v 2
+1 2 3 v 4
:> Post '[JSON] (The Response)
-1 2 4 v 3
+1 2 3 v 4
-v 2 4 1 3
+v 1 2 3 4
deriving instance FromJSONKey StateName
v
deriving anyclass instance FromJSON Base
@@ -279,14 +279,14 @@ foo = do
bar :: Wibble <- baz
2 1 v
where baz = _
-3 2 1 v
+2 3 1 v
-- checking that comments are ignored in layout
-3 2 1 v
+2 3 1 v
-- and that a starting syntax entry is ok
-3 2 1 v
+2 3 1 v
(+) = _
-1 3 2 v
+1 2 3 v
-1 3 2 v
+1 2 3 v
test = 1 `shouldBe` 1
v
\ No newline at end of file
- [nongnu] elpa/haskell-tng-mode 0506391 109/385: module ... where indents to 0, (continued)
- [nongnu] elpa/haskell-tng-mode 0506391 109/385: module ... where indents to 0, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode d9bbcdd 111/385: next steps, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 6cf67bf 105/385: indentation can't handle mismatched parens, don't test for it, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 25b15eb 102/385: indentation alternatives wiring, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e023657 107/385: SMIE wishlist, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 497214b 119/385: syntax tests and bugfixes, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode df5d2c5 122/385: better whitespace gap detection, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3b7cd02 123/385: some todos, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode fc4d3e3 127/385: compilation mode supports multiline error spans, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 88bad65 128/385: visually distinguish compile errors and warnings, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 9dc0abc 129/385: alt indentation levels should be ordered,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 879fc34 130/385: thots, ELPA Syncer, 2021/10/06
- [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