Description
Your environment
Which OS do you use: macOS
Which LSP client (editor/plugin) do you use: Doom Emacs + LSP Mode/lsp-haskell
Describe your project (alternative: link to the project):
Minimal Reproduction
Steps to reproduce
- Install haskell-language-server version 1.6.1.0, GHC 8.10.7, and stack 2.7.3, implicit-hie. and the latest Doom Emacs with
lsp
,lsp-haskell
, andformat +onsave
. - Configure lsp-haskell as follows in the doom config:
;; Haskell
;; Process
(after! lsp-haskell
(setq haskell-process-type 'stack)
(setq lsp-haskell-brittany-on nil)
(setq lsp-haskell-fourmolu-on nil)
(setq lsp-haskell-ormolu-on nil)
(setq lsp-haskell-floskell-on nil)
(setq lsp-ui-doc-show-with-cursor t)
(setq lsp-haskell-formatting-provider "stylish-haskell")
(setq flycheck-hlintrc ".hlint.yaml"))
- Build the project using
stack build
- Generate hie.yaml if necessary
gen-hie > hie.yaml
- Open app/Main.hs in a buffer, make a modification, and save. Everything should work fine.
- Open other-app/Main.hs in a buffer, make a modification, and save. You will get an error:
Error: (doom-hook-error before-save-hook format-all-buffer--from-hook (error "Exception in plugin PluginId \"stylish-haskell\"while processing STextDocumentFormatting: BadDependency \"GetModSummary\""))
Expected behaviour
The stylish-haskell plugin should be able to format the file. Other formatters work correctly (at least, the Ormolu plugin does).
Actual behaviour
Formatting does not occur and an error is written to the Emacs message buffer:
Error: (doom-hook-error before-save-hook format-all-buffer--from-hook (error "Exception in plugin PluginId \"stylish-haskell\"while processing STextDocumentFormatting: BadDependency \"GetModSummary\""))
Include debug information
--probe-tools output:
haskell-language-server version: 1.6.1.0 (GHC: 8.10.7) (PATH: /Users/r258625/.ghcup/bin/haskell-language-server-wrapper-1.6.1.0) (GIT hash: f4022c5bb8530cd306c53b941878244bf27a5d41)
Tool versions found on the $PATH
cabal: 3.6.2.0
stack: 2.7.3
ghc: 8.10.7
I couldn't find much else in the logs that looked problematic.
One thing I did find is that this issue only seems to occur (at least consistently) when two executable entrypoints have the same file name. If I change other-app/Main.hs
to other-app/OtherMain.hs
, rebuild, regenerate the hie.yaml, and restart the language server, the issue appears to be resolved. I think the issue is that having more than one file with the same name could be breaking the plugin. It also seems that this is only an issue with executable entry points. There are no issues with two files in the lib being called Lib.hs and Foo/Lib.hs for instance.