From 1a66fdc4cb597b485f58140c18f6d90da1eb5632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Fayzrakhmanov=20=28=D0=90=D1=80=D1=82=D1=83=D1=80?= =?UTF-8?q?=20=D0=A4=D0=B0=D0=B9=D0=B7=D1=80=D0=B0=D1=85=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=29?= Date: Wed, 23 Mar 2016 03:53:54 +0500 Subject: [PATCH 1/2] Update completion section --- doc/haskell-mode.texi | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/doc/haskell-mode.texi b/doc/haskell-mode.texi index 8fc78e5c7..2defe3715 100644 --- a/doc/haskell-mode.texi +++ b/doc/haskell-mode.texi @@ -303,29 +303,52 @@ 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 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, 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 From cf1d0b8df75b392a844b6748830389b51c5bded0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Fayzrakhmanov=20=28=D0=90=D1=80=D1=82=D1=83=D1=80?= =?UTF-8?q?=20=D0=A4=D0=B0=D0=B9=D0=B7=D1=80=D0=B0=D1=85=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=29?= Date: Thu, 24 Mar 2016 23:14:14 +0500 Subject: [PATCH 2/2] Add Tags section --- doc/haskell-mode.texi | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/haskell-mode.texi b/doc/haskell-mode.texi index 2defe3715..7360a6d5b 100644 --- a/doc/haskell-mode.texi +++ b/doc/haskell-mode.texi @@ -309,13 +309,26 @@ 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 out-of-box. @code{haskell-mode} completes -identifiers using tags, however you can get more precise completions -with @code{haskell-interactive-mode}. In interactive mode completion -candidates are produced by querying GHCi REPL. +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}