Skip to content

Update completion section #1230

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
Mar 25, 2016
Merged
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
52 changes: 44 additions & 8 deletions doc/haskell-mode.texi
Original file line number Diff line number Diff line change
Expand Up @@ -303,29 +303,65 @@ To just align imports, jump to an import section and run
As an alternative to the elisp functions described above, haskell-mode
can use the program @url{
http://hackage.haskell.org/package/stylish-haskell, stylish-haskell}
to format imports. You can set this behavior by typing: @kbd{M-x
customize-variable @key{RET} haskell-stylish-on-save}. You can
install @code{stylish-haskell} by running @code{stack install
to format imports. You can set this behavior by typing: @kbd{M-x}
@code{customize-variable} @kbd{RET} @code{haskell-stylish-on-save}.
You can install @code{stylish-haskell} by running @code{stack install
stylish-haskell}, or if you have not installed @code{stack},
@code{cabal install stylish-haskell}.

@section Haskell Tags

@code{haskell-mode} can generate tags when saving source files. To
generate tags @code{haskell-mode} uses external program —
@url{https://github.com/MarcWeber/hasktags, Hasktags}
(@url{https://wiki.haskell.org/Tags, wiki-article}). To turn on tags
generatation customize or set to @code{t} @code{haskell-tags-on-save}
variable. Also, you may find useful to revert tags tables
automatically, this can be done by customizing
@code{tags-revert-without-query} variable (either globally or for
Haskell buffers only).

@section Completion support

@code{haskell-mode} can complete symbols, pragma directives and language
extensions. This is part of @code{haskell-interactive-mode}.
@code{haskell-mode} can complete symbols, pragma directives and
language extensions out-of-box. @code{haskell-mode} completes
identifiers using tags (see @xref{Tags}), however you can get more
precise completions with @code{haskell-interactive-mode}. In
interactive mode completion candidates are produced by querying GHCi
REPL.

@ifhtml
@image{anim/company-mode-language-pragma}
@end ifhtml

If haskell-interactive-mode is enabled and working haskell mode provides
completions for import statements taking into account currently loaded
and available packages.
If haskell-interactive-mode is enabled and working haskell mode
provides completions for import statements taking into account
currently loaded and available packages.

@ifhtml
@image{anim/company-mode-import-statement}
@end ifhtml

Unfortunatelly, it is not possible to provide candidates for
identifiers defined locally in @code{let} and @code{where} blocks even
in interactive mode. But if you're using
@url{http://company-mode.github.io/, company-mode} you can override
@code{company-backends} variable for Haskell buffers to combine
completion candidates from completion-at-point function
(@code{company-capf} backend) and dynamic abbrevs.
@code{company-mode} provides special backend for dabbrev code
completions, namely @code{company-dabbrev-code}. To combine
completions from diffrent backends you can create grouped backends, it
is very easy — a grouped backend is just a list of backends:

@lisp
(add-hook 'haskell-mode-hook
(lambda ()
(set (make-local-variable 'company-backends)
(append '((company-capf company-dabbrev-code))
company-backends))))
@end lisp

@section Profiling and Debugging support

When profiling code with GHC, it is often useful to add
Expand Down