Add +ghcide flag to lang/haskell

Closes #2622
This commit is contained in:
Henrik Lissner 2020-03-29 18:28:20 -04:00
parent 5308dbd544
commit 00a21e98f0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 32 additions and 18 deletions

View file

@ -107,7 +107,7 @@ Modules that bring support for a language or group of languages to Emacs.
+ [[file:../modules/lang/fsharp/README.org][fsharp]] - TODO + [[file:../modules/lang/fsharp/README.org][fsharp]] - TODO
+ [[file:../modules/lang/fstar/README.org][fstar]] - F* support + [[file:../modules/lang/fstar/README.org][fstar]] - F* support
+ [[file:../modules/lang/go/README.org][go]] =+lsp= - TODO + [[file:../modules/lang/go/README.org][go]] =+lsp= - TODO
+ [[file:../modules/lang/haskell/README.org][haskell]] =+dante +intero +lsp= - TODO + [[file:../modules/lang/haskell/README.org][haskell]] =+dante +ghcide +lsp +intero= - TODO
+ hy - TODO + hy - TODO
+ [[file:../modules/lang/idris/README.org][idris]] - TODO + [[file:../modules/lang/idris/README.org][idris]] - TODO
+ java =+meghanada +lsp= - TODO + java =+meghanada +lsp= - TODO

View file

@ -1,10 +1,14 @@
;;; lang/haskell/+lsp.el -*- lexical-binding: t; -*- ;;; lang/haskell/+lsp.el -*- lexical-binding: t; -*-
(use-package! lsp-haskell (use-package! lsp-haskell
:after haskell-mode :after lsp-clients
:init (add-hook 'haskell-mode-hook #'lsp!) :init (add-hook 'haskell-mode-local-vars #'lsp!)
:config :config
(when IS-MAC (when IS-MAC
(setq lsp-haskell-process-path-hie "hie-wrapper")) (setq lsp-haskell-process-path-hie "hie-wrapper"))
;; Does some strange indentation if it pastes in the snippet ;; Does some strange indentation if it pastes in the snippet
(setq-hook! 'haskell-mode-hook yas-indent-line 'fixed)) (setq-hook! 'haskell-mode-hook yas-indent-line 'fixed)
(when (featurep! +ghcide)
(setq lsp-haskell-process-path-hie "ghcide"
lsp-haskell-process-args-hie nil)))

View file

@ -10,7 +10,8 @@
- [[#plugins][Plugins]] - [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]] - [[#prerequisites][Prerequisites]]
- [[#cabal][Cabal]] - [[#cabal][Cabal]]
- [[#lsp][LSP]] - [[#lsp-haskell-ide-engine][LSP (haskell-ide-engine)]]
- [[#lsp-ghcide][LSP (ghcide)]]
- [[#stack][Stack]] - [[#stack][Stack]]
- [[#haskell-packages][Haskell packages]] - [[#haskell-packages][Haskell packages]]
- [[#configuration][Configuration]] - [[#configuration][Configuration]]
@ -18,8 +19,8 @@
- [[#troubleshooting][Troubleshooting]] - [[#troubleshooting][Troubleshooting]]
* Description * Description
This module adds [[https://www.haskell.org/][Haskell]] support, powered by either [[https://github.com/jyp/dante][dante]] (the default), LSP or This module adds [[https://www.haskell.org/][Haskell]] support, powered by either [[https://github.com/jyp/dante][dante]] (the default), LSP
[[https://haskell-lang.org/intero][intero]]. (haskell-language-server or ghcide) or [[https://haskell-lang.org/intero][intero]].
+ Code completion (~company-ghc~) + Code completion (~company-ghc~)
+ Look up documentation (~hoogle~) + Look up documentation (~hoogle~)
@ -41,7 +42,9 @@ Here are a few resources I've found indispensable in my Haskell adventures:
+ =+dante= Enables dante; a fork of intero aimed at lightweightedness. It + =+dante= Enables dante; a fork of intero aimed at lightweightedness. It
doesn't depend on =stack=, supports both ~cabal~-only and ~stack~ projects, doesn't depend on =stack=, supports both ~cabal~-only and ~stack~ projects,
but lacks eldoc support. but lacks eldoc support.
+ =+lsp= Enables lsp-haskell (this requires the ~:tools lsp~ to be enabled). + =+ghcide= Enables LSP support with ghcide (requires the ~:tools lsp~ module).
+ =+lsp= Enables LSP support with haskell-ide-engine (requires the ~:tools lsp~
module).
+ =+intero= (Deprecated) Enables intero; a comprehensive, stack-based + =+intero= (Deprecated) Enables intero; a comprehensive, stack-based
development environment for Haskell. development environment for Haskell.
@ -53,7 +56,7 @@ Here are a few resources I've found indispensable in my Haskell adventures:
+ =+lsp= + =+lsp=
+ [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]] + [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]]
+ =+intero= + =+intero=
+ [[https://github.com/chrisdone/intero][intero]] + [[https://github.com/chrisdone/intero][intero]] =DEPRECATED=
* Prerequisites * Prerequisites
Depending on whether you use Intero, Dante or LSP, your dependencies will Depending on whether you use Intero, Dante or LSP, your dependencies will
@ -83,7 +86,7 @@ sudo pacman -S cabal-install ghc
sudo zypper install cabal-install ghc sudo zypper install cabal-install ghc
#+END_SRC #+END_SRC
** LSP ** LSP (haskell-ide-engine)
You will need =stack= and =git= installed. You will need =stack= and =git= installed.
You will find a comprehensive [[https://github.com/haskell/haskell-ide-engine#installation][install guide for haskell-ide-engine on its You will find a comprehensive [[https://github.com/haskell/haskell-ide-engine#installation][install guide for haskell-ide-engine on its
@ -92,7 +95,7 @@ project page]], but here's a TL;DR:
*** MacOS *** MacOS
haskell-ide-engine must be build and installed manually on MacOS, e.g. haskell-ide-engine must be build and installed manually on MacOS, e.g.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC bash
git clone https://github.com/haskell/haskell-ide-engine git clone https://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine cd haskell-ide-engine
make make
@ -101,9 +104,11 @@ make
*** Arch Linux *** Arch Linux
=haskell-ide-engine-git= is available on the AUR =haskell-ide-engine-git= is available on the AUR
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC bash
yay -S haskell-ide-engine-git yay -S haskell-ide-engine-git
#+END_SRC #+END_SRC
** LSP (ghcide)
See https://github.com/digital-asset/ghcide for install instructions.
** Stack ** Stack
To use Intero or LSP, you need =stack=: To use Intero or LSP, you need =stack=:

View file

@ -3,14 +3,9 @@
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "stack.yaml")) (add-to-list 'projectile-project-root-files "stack.yaml"))
;; TODO ghcide?
(cond ((featurep! +intero) (load! "+intero")) ; DEPRECATED
((featurep! +dante) (load! "+dante"))
((featurep! +lsp) (load! "+lsp")))
;; ;;
;; Common packages ;;; Common packages
(after! haskell-mode (after! haskell-mode
(setq haskell-process-suggest-remove-import-lines t ; warnings for redundant imports etc (setq haskell-process-suggest-remove-import-lines t ; warnings for redundant imports etc
@ -45,3 +40,13 @@
"c" #'haskell-cabal-visit-file "c" #'haskell-cabal-visit-file
"h" #'haskell-hide-toggle "h" #'haskell-hide-toggle
"H" #'haskell-hide-toggle-all)) "H" #'haskell-hide-toggle-all))
;;
;;; Backends
(cond ((featurep! +intero) (load! "+intero")) ; DEPRECATED
((featurep! +dante) (load! "+dante"))
((or (featurep! +lsp)
(featurep! +ghcide))
(load! "+lsp")))