From e1538c211da815f17b68fbb44424c396a2bcaf95 Mon Sep 17 00:00:00 2001 From: Carman Fu <96031125+Futarimiti@users.noreply.github.com> Date: Sat, 3 Aug 2024 23:57:17 +0800 Subject: [PATCH 1/3] improve do-notation correctly indent further statements in do-notation when the first statement is right after `do` --- indent/haskell.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indent/haskell.vim b/indent/haskell.vim index 54f244a..7cfad33 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -148,6 +148,10 @@ function! GetHaskellIndent() abort return match(nonblankline, '\v^\s*%(|.*)?\s*\zs') + &shiftwidth endif + if nonblankline =~# '\v\s*[[:alnum:](]' + return match(nonblankline, '\v\s*\zs\S') + endif + if nonblankline =~# '\v' return s:indent('', '\v^\s*\zs', 0) endif From b86e9a229c1caaa9def679a3f482eac45f855a64 Mon Sep 17 00:00:00 2001 From: Futar Date: Sun, 4 Aug 2024 10:12:28 +0800 Subject: [PATCH 2/3] add tests for do-notation with first stmt on the same line --- test/do/do_same_line.in.hs | 2 ++ test/do/do_same_line.out.hs | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 test/do/do_same_line.in.hs create mode 100644 test/do/do_same_line.out.hs diff --git a/test/do/do_same_line.in.hs b/test/do/do_same_line.in.hs new file mode 100644 index 0000000..3561492 --- /dev/null +++ b/test/do/do_same_line.in.hs @@ -0,0 +1,2 @@ +main = do print "hello" +print "world" diff --git a/test/do/do_same_line.out.hs b/test/do/do_same_line.out.hs new file mode 100644 index 0000000..eed0ee1 --- /dev/null +++ b/test/do/do_same_line.out.hs @@ -0,0 +1,2 @@ +main = do print "hello" + print "world" From 98d100df9d1316213518305e43e83ecfde7b1fc7 Mon Sep 17 00:00:00 2001 From: Futar Date: Sun, 4 Aug 2024 10:17:40 +0800 Subject: [PATCH 3/3] update date of last change --- indent/haskell.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indent/haskell.vim b/indent/haskell.vim index 7cfad33..2ad193e 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -2,7 +2,7 @@ " Filename: indent/haskell.vim " Author: itchyny " License: MIT License -" Last Change: 2023/11/07 19:40:39. +" Last Change: 2024/08/04 10:17:25. " ============================================================================= if exists('b:did_indent')