branch: elpa/haskell-tng-mode commit adb3c50efb1ddbccfac126a0488d1d674fe44f7a Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
better insert indentation suggestions --- haskell-tng-smie.el | 13 ++++--------- test/src/indentation.hs.insert.indent | 10 +++++----- test/src/indentation.hs.reindent | 10 +++++----- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el index db485c9..b4ebc93 100644 --- a/haskell-tng-smie.el +++ b/haskell-tng-smie.el @@ -144,10 +144,10 @@ information, to aid in the creation of new rules." ;; the parameter requirements for function calls. For simple cases, we ;; should be able to infer if the user wants to terminate ; or continue ;; "" the current line. - ;; - ;; TODO if there is already an empty lines before here, perhaps best to - ;; close out the indentation with a }. - ('empty-line-token ";") + ('empty-line-token + ;; BUG smie-rule-next-p needs smie--after to be defined + (setq smie--after (point)) + (when (smie-rule-next-p ";" "}") ";")) )) ;; Patterns of the form @@ -157,8 +157,6 @@ information, to aid in the creation of new rules." ;; get called with `:list-intro "HEAD"` when indenting positions A and B. (:list-intro (pcase arg - ;; TODO work out why we need these list-intro rules. Re-indentation of - ;; continued lines in WLDOs don't behave as expected without. ((or "<-" "=") t) )) @@ -268,9 +266,6 @@ current line." #'haskell-tng-smie:rules :forward-token #'haskell-tng-lexer:forward-token :backward-token #'haskell-tng-lexer:backward-token) - - ;; disables blinking paren matching based on grammar - (setq smie-closer-alist nil) ) ;; SMIE wishlist, in order of desirability: diff --git a/test/src/indentation.hs.insert.indent b/test/src/indentation.hs.insert.indent index 442c096..9578e89 100644 --- a/test/src/indentation.hs.insert.indent +++ b/test/src/indentation.hs.insert.indent @@ -35,9 +35,9 @@ basic_do = do foo <- blah blah blah 1 v bar <- blah blah -2 v 1 +2 1 v blah -- manual correction -2 v 1 +1 2 v blah -- manual correction 2 v 1 sideeffect @@ -45,7 +45,7 @@ basic_do = do sideeffect' blah 2 v 1 3 let baz = blah blah -3 1 v 4 2 +3 2 1 4 v blah -- manual correction 2 3 v 4 1 gaz = blah @@ -69,13 +69,13 @@ nested_do = -- manual correction 1 2 v nested_where a b = foo a b -v +1 v where -- TODO 2 1 v foo = bar baz -- indented 1 v baz = blah blah -- same level as foo -1 v +2 1 v where -- manual correction 1 2 v gaz a = blah -- indented diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent index f9fa74f..6428102 100644 --- a/test/src/indentation.hs.reindent +++ b/test/src/indentation.hs.reindent @@ -84,19 +84,19 @@ v 2 1 faz = blah -- same level as gaz 1 2 v -v 1 2 +1 2 3 v -- TODO case statements -v 1 2 +1 2 3 v -- TODO let / in 1 2 v -v 1 2 +1 2 3 v -- TODO coproduct definitions, the | should align with = 1 2 v -v 1 2 +1 2 3 v -- TODO lists, records, tuples 1 2 v -v 1 2 +1 2 3 v -- TODO long type signatures vs definitions \ No newline at end of file