Skip to content

Commit ff4b5c7

Browse files
committed
Merge pull request #909 from gracjan/pr-quesiquotes-indentation
Implement QuasiQuotes syntax in indentation
2 parents dd169b4 + 4852612 commit ff4b5c7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

haskell-indentation.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,8 @@ line."
13581358
(if (or (looking-at "'\\([^\\']\\|\\\\.\\)'")
13591359
(looking-at "'\\\\\\([^\\']\\|\\\\.\\)*'")
13601360
(looking-at "\"\\([^\\\"]\\|\\\\.\\)*\"")
1361+
;; QuasiQuotes, with help of propertize buffer and string delimeters
1362+
(looking-at "\\s\"\\S\"*\\s\"")
13611363
;; Hierarchical names always start with uppercase
13621364
(looking-at
13631365
"[[:upper:]]\\(\\s_\\|\\sw\\|'\\)*\\(\\.\\(\\s_\\|\\sw\\|'\\)+\\)*")

tests/haskell-indentation-tests.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
(require 'cl-lib)
2626
(require 'ert)
2727
(require 'haskell-mode)
28+
(require 'haskell-font-lock)
2829
(require 'haskell-indentation)
2930

3031
;;; Code:
@@ -70,6 +71,7 @@ because it helps increase coverage."
7071
(haskell-indentation-mode 1)
7172
(insert source)
7273
(newline)
74+
(font-lock-fontify-buffer)
7375
(goto-char (point-min))
7476
(forward-line (1- line))
7577
(move-to-column column)
@@ -589,5 +591,18 @@ function (Operation 'Init) = do
589591
"
590592
((2 0) 2))
591593

594+
(hindent-test "29a quasiquote single line" "
595+
test = [randomQQ| This is a quasiquote with the word in |]
596+
597+
"
598+
((2 0) 0 7))
599+
600+
(hindent-test "29b quasiquote multiple lines" "
601+
test = [randomQQ| This is
602+
a quasiquote
603+
with the word in |]
604+
605+
"
606+
((4 0) 0 7))
592607

593608
;;; haskell-indentation-tests.el ends here

0 commit comments

Comments
 (0)