emacs-lsp / lsp-haskell

lsp-mode :heart: haskell
https://emacs-lsp.github.io/lsp-haskell
GNU General Public License v3.0
227 stars 56 forks source link

Confusion on setting `lsp-haskell-server-wrapper-function` #90

Closed alaird-w closed 3 years ago

alaird-w commented 3 years ago

Hello,

I've been trying to get doom + haskell language server working with nix and cabal. I need the language server to start in the nix-shell, so I made the following change to config.el:

;; suggested at https://github.com/emacs-lsp/lsp-haskell/blob/4d85cb3693d893ec34d8a0be9794d468a0a28b7b/lsp-haskell.el#L110
(setq lsp-haskell-server-wrapper-function
      (lambda (argv)
        (append
         (append (list \"nix-shell\" \"-I\" \".\" \"--command\" )
                 (list (mapconcat 'identity argv \" \"))
                 )
         (list (concat (lsp-haskell--get-root) \"/shell.nix\")))))

Note that executing nix-shell works fine. However, I'm still getting the following error in *lsp-haskell::stderr*:

"Error when calling cabal v2-exec ghc -v0 -- --numeric-version"

Which executes fine in nix-shell from the command line:

$ nix-shell -I . --command "cabal v2-exec ghc -v0 -- --numeric-version"
8.8.4

tried various different things to get this working, so far no luck. Any suggestions? Thanks!

alaird-w commented 3 years ago

apologies for missing the escaped quotes (copied from the docstring without looking closely!)