Skip to content

Improve can grab prefix for completions #946

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 2 commits into from
Oct 18, 2015
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
4 changes: 2 additions & 2 deletions haskell-completions.el
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ whitespace or new line, otherwise returns nil.

Returns nil in presense of active region."
(when (not (region-active-p))
(when (looking-at (rx (| space line-end punct)))
(when (looking-at-p (rx (| space line-end punct)))
(when (not (bobp))
(save-excursion
(backward-char)
(not (looking-at (rx (| space line-end)))))))))
(not (looking-at-p (rx (| space line-end)))))))))

(defun haskell-completions-grab-pragma-prefix ()
"Grab completion prefix for pragma completions.
Expand Down
9 changes: 3 additions & 6 deletions tests/haskell-completions-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@
(save-excursion (insert "bcd"))
(should (eql nil (haskell-completions-can-grab-prefix)))
;; region case
(let ((p (point)))
(goto-char (point-min))
(push-mark)
(goto-char p)
(activate-mark)
(should (eql nil (haskell-completions-can-grab-prefix))))))
(push-mark (point-min) t)
(activate-mark)
(should (eql nil (haskell-completions-can-grab-prefix)))))


(ert-deftest haskell-completions-grab-pragma-prefix-nil-cases-test ()
Expand Down