Skip to content

Treat insides of quasiquotes as strings #1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion haskell-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,13 @@ executable found in PATH.")
(put-text-property (match-beginning 3) (1+ (match-end 3)) 'syntax-table (string-to-syntax "|")))))
((equal token-kind 'template-haskell-quasi-quote)
(put-text-property (match-beginning 2) (match-end 2) 'syntax-table (string-to-syntax "\""))
(put-text-property (match-beginning 4) (match-end 4) 'syntax-table (string-to-syntax "\""))))
(put-text-property (match-beginning 4) (match-end 4) 'syntax-table (string-to-syntax "\""))
(save-excursion
(goto-char (match-beginning 3))
(let ((limit (match-end 3)))
(save-match-data
(while (re-search-forward "\"" limit t)
(put-text-property (match-beginning 0) (match-end 0) 'syntax-table (string-to-syntax "."))))))))
(if token-kind
(goto-char (match-end 0))
(goto-char end)))))))
Expand Down
12 changes: 11 additions & 1 deletion tests/haskell-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,23 @@ test = [randomQQ| This is
"
(4 0 2))

(hindent-test "29c* quasiquote with quotes in it and a string outside" "
(hindent-test "29c quasiquote with quotes in it and a string outside" "
foo = do
let bar = [text|\"some text\"|]
button \"Cancel\" $ do
"
(4 4))

(hindent-test "29d unfinished quasiquote" "
foo = [text|some
"
(2 0 11))

(hindent-test "29e an expression quotation" "
foo = [|forever $ do
"
(2 10))

(hindent-test "30* parse '[] identifier correctly" "
instance Callable '[]
"
Expand Down