Add hlint-refactor to haskell layer

This commit is contained in:
Paul Wise 2016-05-29 22:07:37 -06:00 committed by syl20bnr
parent 583415cdf8
commit 90c09f94bc
2 changed files with 24 additions and 1 deletions

View file

@ -23,6 +23,7 @@
- [[REPL][REPL]]
- [[Cabal commands][Cabal commands]]
- [[Cabal files][Cabal files]]
- [[Refactor][Refactor]]
- [[Ghc-mod][Ghc-mod]]
- [[Insert template][Insert template]]
- [[Syntax checking][Syntax checking]]
@ -65,6 +66,7 @@ file.
** Dependencies
This layer requires some [[https://www.haskell.org/cabal/][cabal]] packages:
- =apply-refact=
- =hlint=
- =stylish-haskell=
- =hasktags=
@ -74,7 +76,7 @@ This layer requires some [[https://www.haskell.org/cabal/][cabal]] packages:
To install them, use following command (or the =stack= equivalent):
#+BEGIN_SRC sh
$ cabal install stylish-haskell hlint hasktags ghc-mod hoogle
$ cabal install apply-refact stylish-haskell hlint hasktags ghc-mod hoogle
#+END_SRC
** Setup PATH
@ -327,6 +329,16 @@ This commands are available in a cabal file.
| ~SPC m P~ | go to previous section |
| ~SPC m f~ | find or create source-file under the cursor |
** Refactor
Refactor commands are prefixed by ~SPC m r~:
| Key Binding | Description |
|-------------+---------------------------------------------------|
| ~SPC m r b~ | apply all HLint suggestions in the current buffer |
| ~SPC m r r~ | apply the HLint suggestion under the cursor |
Only some of the HLint suggestions can be applied.
** Ghc-mod
These commands are only available when ghc-mod is enabled.

View file

@ -25,6 +25,7 @@
haskell-snippets
(helm-hoogle :toggle (configuration-layer/package-usedp 'helm))
hindent
hlint-refactor
shm
))
@ -309,6 +310,16 @@
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode
"F" 'hindent-reformat-decl))))
(defun haskell/init-hlint-refactor ()
(use-package hlint-refactor
:defer t
:init
(progn
(spacemacs/declare-prefix-for-mode 'haskell-mode "mr" "haskell/refactor")
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode
"rb" 'hlint-refactor-refactor-buffer
"rr" 'hlint-refactor-refactor-at-point))))
(defun haskell/init-shm ()
(use-package shm
:defer t