There’s a lot of grumbles out there that HLS doesn’t work at times. This may well be an undocumented behaviour, or my imagination, but it really helps to boot up HLS into an environment where a successful build has already occurred.
Many, many people keep an alternative compilation loop handy.
cabal build and
ghcid all fit the bill. You get the project back to green, and then HLS can go from there.
In emacs, if LSP goes on the blink, it gives you a big green tick, and you can go on your way for a good while. From a good initial state and boot-up it tracks incremental change like a boss, until you fool around with your cabal file, and I imagine best practice is to then recompile using cabal before rebooting HLS.