reddit / emacs

Why doesn't LSP connect to Emacs here? (lsp-mode)

CaterpillarNo2326 · 2022-10-04 20:56
When opening a buffer that has a language server installed (right now, that's only clangd and haskell-language-server), the modeline says that LSP is activated, just disconnected. My config file is fairly short right now, so it shouldn't be that difficult to diagnose the issue. I only have LSP and completion plugins installed at the moment. It also uses use-package. Although I think I've looked over all the instructions for each plugin properly, I must have missed something. I would appreciate the help. Link to my init.el: https://pastebin.com/PBkVPVDF
lebensterben · 2022-10-04 21:03
nothing seems wrong to me. that said, hls and the entire Haskell toolchain is a pain. what I always do is to have vim setup with lsp and see whether hls starts normally.
CaterpillarNo2326 · 2022-10-04 21:20
I already do have Neovim set up so that both clangd and HLS work correctly on C/C++ and Haskell files. I think the problem must be related to the Emacs configuration in some way.
lebensterben · 2022-10-04 21:25
I don't think you've missed anything and configured anything wrong.... what's your OS, emacs version do you start emacs as daemon via dbus is your emaca a flatpak/snap package where is your clangd, hls, ghc
CaterpillarNo2326 · 2022-10-04 21:31
OS: Void Linux Version: Emacs 28.2 Startup: I don't have Emacs set up as a daemon. I've been restarting Emacs every time. clangd: Installed as part of clang from my package manager. Resides in /bin. HLS: Installed via ghcup. Resides in ~/.ghcup/bin.
lebensterben · 2022-10-04 21:34
for clangd, I haven't seen it fails to start. but for hls, gotta make sure the PATH is set correctly. you can try to evaluate (executable-find "haskell-language-server") to see whether it does point to the one installed by ghcup. then do the same for ghc.
CaterpillarNo2326 · 2022-10-04 21:46
I don't have any executable called `haskell-language-server`, only `haskell-language-server-wrapper`, as well as versions like `haskell-language-server-1.8.0.0` (the former is a symbolic link to the latter). I do have ghc and ghcup, and Emacs is able to find those executables, as well has `haskell-language-server-wrapper`. I double-checked just now again, and HLS really does run in Neovim, even if it takes a while to load, so I don't think that my PATH is the problem.
lebensterben · 2022-10-04 21:50
https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/ in particular, see what does `*lsp-log*` buffer says
CaterpillarNo2326 · 2022-10-04 22:31
Sorry for the 40 minute delay. I can't seem to make it show the log buffer. I set `lsp-log-io` to `t`, but I can't use `M-x lsp-workspace-show-log`, because I don't know what to put there as an argument. I can't use my path, `.`, because that's not a workspace. Nothing autocompletes, and the page you linked doesn't say how to use it. Thanks for the help so far, though.
lebensterben · 2022-10-04 22:55
you can go to lsp-mode's discord channel and ask for help there...
PhantomSeahorse · 2022-10-05 00:57
Emacs might not be seeing your environment variables. Try the package `exec-path-from-shell`
CaterpillarNo2326 · 2022-10-05 03:17
I don't think that's it, because when I evaluate `(getenv "PATH")` from within Emacs, I do see everything in my actual PATH variable. Thank you for letting me know about this package, though, since it might be necessary in the future.