Closed dewijones92 closed 2 years ago
Since it seems like no Haskell or LSP experts are chiming in here, I have to recommend eglot over LSP.
https://github.com/joaotavora/eglot
Though my experience with either is limited, I do know the author of eglot is very active upstream of Emacs and also happens to have wrote SLY (which I enjoy using very much).
https://github.com/joaotavora/sly
Eglot is meant to be plug and play, and I agree personally that cl-defmethod is nicer than a hash table for this design case.
https://github.com/joaotavora/eglot/issues/180
Competition is good! Eglot also has the explicit goal of being upstreamed into
Emacs proper in the future. Try adding eglot' to
dotspacemacs-additional-packages'
@BenedictHW many thanks for that. I gotta try it out :)
@dewijones92 The error message says 'check corresponding stderr buffer for details', have you tried that? What did it say?
@dalanicolai the logs look fine. Which is weird. I don't understand why emacs says it's immediately exiting π
/tmp/hls.log
`2022-07-02T06:56:45.617379Z | Info | haskell-language-server version: 1.7.0.0 (GHC: 9.2.3) (PATH: /home/dewi/.local/bin/haskell-language-server) (GIT hash: 59016bb9ae55b6c59b6866eb3f47c70f255b3c7a)
2022-07-02T06:56:45.617703Z | Info | Directory: /home/dewi/tmp/haskellTut/hell3/helloworld
2022-07-02T06:56:45.617761Z | Info | Starting (haskell-language-server) LSP server...
GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hls.log", argsThreads = 0, argsProjectGhcVersion = False}
PluginIds: [ pragmas
, floskell
, fourmolu
, ormolu
, stylish-haskell
, rename
, callHierarchy
, class
, eval
, importLens
, qualifyImportedNames
, refineImports
, moduleName
, hlint
, alternateNumberFormat
, selectionRange
, changeTypeSignature
, gadt
, ghcide-hover-and-symbols
, ghcide-code-actions-imports-exports
, ghcide-code-actions-type-signatures
, ghcide-code-actions-bindings
, ghcide-code-actions-fill-holes
, ghcide-completions
, ghcide-type-lenses
, ghcide-core
, LSPRecorderCallback ]
2022-07-02T06:56:45.617946Z | Info | Logging heap statistics every 60.00s
2022-07-02T06:56:45.623928Z | Info | Staring LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
lsp-haskell:stderr
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.7.0.0, Gi\
t revision 59016bb9ae55b6c59b6866eb3f47c70f255b3c7a (dirty) (2824 commits) x86_64 ghc-9.2.3
Current directory: /home/dewi/tmp/haskellTut/hell3/helloworld
Operating system: linux
Arguments: ["--lsp","-d","-l","/tmp/hls.log"]
Cradle directory: /home/dewi/tmp/haskellTut/hell3/helloworld
Cradle type: Stack
Tool versions found on the $PATH
cabal: 3.6.2.0
stack: 2.7.5
ghc: 9.2.3
Consulting the cradle to get project GHC version...
Project GHC version: 9.0.2
haskell-language-server exe candidates: ["haskell-language-server-9.0.2","haskell-language-server"]
Launching haskell-language-server exe at:/home/dewi/.local/bin/haskell-language-server
Process lsp-haskell stderr finished
Okay, well I am no LSP/Emacs expert, so I guess the best thing for you to try then is to ask assistance on the lsp-mode gitter channel (maybe point them to this issue).
@dalanicolai thanks, will do
Do you perchance have multiple haskell language servers installed? E.g. a local one in a project dir and a global one? I had this problem too, emacs was starting the wrong one. You can check this by running the shell command which haskell-language-server
in emacs.
In my spacemacs config I have (spacemacs/load-spacemacs-env)
commented out, because the way spacemacs loads environment variables was causing problems like this (in combination with nix and direnv). Didn't seem to break anything else for me π€·. Good luck solving it.
@dewijones92
Please see @blablablerg 's comment above. It's likely to be caused by version conflict.
And yes the way Spacemacs deals with environment variables is error prone.
@blablablerg @lebensterben thanks for your comments.
Unfortunately commenting out (spacemacs/load-spacemacs-env)
did not work.
I only have 1 instance on HLS installed:
$ type -a haskell-language-server
haskell-language-server is /home/dewi/.local/bin/haskell-language-server
$ type -a haskell-language-server-wrapper
haskell-language-server-wrapper is /home/dewi/.local/bin/haskell-language-server-wrapper
does anyone here have HLS working with emacs? if so can you kindly share me your config? thanks
@dewijones92
What's the setup of the project you're working on? It's common that it uses a different ghc version from your system's default and it might cause problem.
wow i just started from a clean spacemacs config and now it works :) yay :)
thanks all for your comments
This is the culprit config. https://github.com/dewijones92/spacemacs.d/tree/07b6ac203027429a33d158ed462292147abfeca2 No idea what the cause is tho
I should have tried a clean config weeks ago ahahah πππππππ’π’π’π’π’
Description Thanks for this amazing project π I am banging my head against a brick wall here π When I run "haskell-mode" I expcet it to run the associated language server. But it is not.
System info Spacemacs version: develop branch -
4eaff25268634fcb8137b91fb7d0b7598588cbca - Date: Mon Jun 20 23:12:45 2022 -0400
My
~/.spacemacs.d
very vanilla https://github.com/dewijones92/spacemacs.d/blob/5fc5a78fafcf6bcdc086217d8aa469f6137a49cd/init.el#L114Reproduction guide πͺ²
haskell-mode
Observed behaviour: π π Error message
Expected behaviour: β€οΈ Spacemacs should run
haskell-language-server