reddit / emacs

Need some help getting lsp-haskell to work with hls in emacs.

omeow · 2022-09-29 06:35
I am having some issues with getting lsp to work with hls. I use lsp-mode for python and that works fine. So, I am guessing I am doing something wrong with hls but any suggestions will be greatly appreciated!! ``` ;; LSP Part of my emacs.d (use-package lsp-mode :init (setq lsp-keymap-prefix "C-c l") :hook ((python-mode . lsp) (lsp-mode . lsp-enable-which-key-integration)) :commands lsp) (add-hook 'haskell-mode-hook #'lsp) (add-hook 'haskell-literate-mode-hook #'lsp) (use-package lsp-haskell :ensure t :defer t ) (use-package lsp-pyright :ensure t :hook (python-mode . (lambda () (require 'lsp-pyright) (lsp-deferred)))) ; or lsp-deferred) ``` I used `ghcup` to install `ghc` and `hls` on my system (linux). Running `haskell-language-server-wrapper` on the shell works. However, when I run `lsp` on haskell code in emacs I keep getting the following issue ``` LSP :: The following servers support current file but do not have automatic installation: lsp-haskell You may find the installation instructions at https://emacs-lsp.github.io/lsp-mode/page/languages. (If you have already installed the server check *lsp-log*). ``` Looking at *lsp-log* : ```Command "home/.ghcup/hls/1.7.0.0/bin/haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is not present on the path. Command "home/.ghcup/hls/1.7.0.0/bin/haskell-language-server-wrapper --lsp -d -l /tmp/hls.log" is not present on the path. ``` Thanks in advance for your time and help!
lebensterben · 2022-09-29 06:42
check whether ~/.ghcup is in your PATH (that is available at the time when emacs/emacsclient starts)
omeow · 2022-09-30 06:14
Thank you. `ghcup` is in the path. I also added it to `exec-path` but still no change. Any other ideas?
yoogui · 2022-11-10 17:06
I'm on the same trouble. If I execute ```haskell-language-server-wrapper``` in a terminal it works. But eglot, can't find the executable.
omeow · 2022-11-11 04:11
I gave up trying to fix it. I was losing my santiy trying to go through the documentation which isnt great and I decided that I can live with haskell-mode + formatter for now.