emacs-lsp/lsp-haskell

(void-variable lsp-haskell-formatting-provider)

josefs opened this issue · 2 comments

I'm having trouble starting to use lsp-haskell. I've followed the installation instructions but when I open a Haskell file I get:

File mode specification error: (void-variable lsp-haskell-formatting-provider)

What am I doing wrong and how do I fix it? I don't particularly need a formatter and I don't have any installed at the moment.

My currently installed package version:
lsp-mode 8.0.0
lsp-haskell 20220809.2129

I've got the same error and managed to fix it for myself:

  • I'm using emacs native
  • I had lsp-haskell pinned to melpa, which installed version 20220809.2129 (latest from github)
  • I had lsp-mode also pinned to melpa, which installed the release version 8.0.0

It turns out that the latest git version of lsp-haskell uses the macro defcustom-lsp which was implemented in lsp-mode in emacs-lsp/lsp-mode@491d667, Oct 27, 2021 but lsp-mode 8.0.0 was released Sep 4, 2021

Or in other words: your lsp-mode version is too old for lsp-haskell. And it appears that compiling lsp-haskell with the missing macro somehow leads to broken byte code rather than aborting the compilation.

How to fix:

  • Install the latest git version of lsp-mode
  • Delete the cached compiled lsp-haskell (rm -rf ~/.emacs.d/elpa/lsp-haskell-*)
  • Reinstall lsp-haskell

Not sure there's anything to do here