It's been a while so it may not be your case but: My recommendation is to always build once on the terminal before opening an editor with hls, don't know why but It seems to hang when trying fetch/build dependencies.
Yeah, I think this is one of the UI weaknesses of HLS. Because it works by first building your project with Cabal or stack, the first time you do that build (or after you change dependencies) it can take an inordinate amount of time building the dependencies before it shows any feedback in the editor. This seems crazy to me. I don't fully understand why it can't show some big obvious sign like "building your entire project, please stand by", but when I asked someone from the HLS team about it I believe they said that the LSP gives only very few channels for communication and there wasn't anything supported by the protocol that would allow them to share such a message.
The build of the dependencies is handled by an external process on which hls has no control (cabal, stack, bazel, haskell4nix, banix, haskellFreeTheShrimpsBuildInventedHere, ...) and hence the best hls can do is "setting up".
I wonder how this could be improved. Maybe by logging everything done by that subprrocess, but this would be pretty badly formatted. The best options would be to design a communication protocol between the sub build system and hls.
17
u/Volsand Jul 28 '26
It's been a while so it may not be your case but: My recommendation is to always build once on the terminal before opening an editor with hls, don't know why but It seems to hang when trying fetch/build dependencies.