Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Last active November 14, 2016 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisajenkins/6417f196291d8d387976 to your computer and use it in GitHub Desktop.
Save krisajenkins/6417f196291d8d387976 to your computer and use it in GitHub Desktop.
GHCi REPL-style completions for company-mode
(require 'cl-lib)
(require 'thingatpt)
(defun haskell-process-completions-at-point ()
"A company-mode-compatible complete-at-point function."
(-when-let (process (haskell-process))
(-when-let (symbol (symbol-at-point))
(destructuring-bind (start . end) (bounds-of-thing-at-point 'symbol)
(let ((completions (haskell-process-get-repl-completions (haskell-process)
(symbol-name symbol))))
(list start end completions))))))
(add-hook 'haskell-mode-hook
(lambda ()
(setq-local completion-at-point-functions
'(haskell-process-completions-at-point))))
@krisajenkins
Copy link
Author

This is now integrated into haskell-mode, so find it there m'friends...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment