 considered."
   (when (intero-completions-can-grab-prefix)
     (let ((prefix (cond
-                   ((intero-completions-grab-ghci-command))
                    ((intero-completions-grab-pragma-prefix))
                    ((intero-completions-grab-identifier-prefix)))))
       (cond ((and minlen prefix)

        (save-excursion
          (backward-char)
          (not (looking-at-p (rx (| space line-end)))))))))

(defun intero-completions-grab-ghci-command ()
  "Grab prefix for a ghci command like :set.
Returns (prefix-start-position prefix-end-position prefix-value prefix-type)"
  (when (derived-mode-p 'intero-repl-mode)
    (save-excursion
      (let ((end (point)))
        (when (save-excursion
                (beginning-of-line)
                (looking-at-p (rx (* " ")
                                  ":set"
                                  (* " "))))
          (skip-syntax-backward "^ >")
          (let ((start (point)))
            (list start
                  end
                  (concat ":set " (buffer-substring-no-properties start end))
                  'haskell-completions-repl-command)))))))

(defun intero-completions-grab-identifier-prefix ()
  "Grab identifier prefix."

  (setq-local comint-prompt-regexp intero-prompt-regexp)
  (setq-local warning-suppress-types (cons '(undo discard-info) warning-suppress-types))
  (setq-local comint-prompt-read-only t)
  (add-hook 'completion-at-point-functions 'intero-repl-completion-at-point nil t)
  (company-mode))

(defun intero-repl-mode-start (backend-buffer targets prompt-options stack-yaml)
