1

I have Spacemacs configured to use Metals as an LSP backend for Scala development, i.e. my dotspacemacs-configuration-layers includes:

     (scala :variables
            scala-backend 'scala-metals
            scala-enable-eldoc t
            scala-use-unicode-arrows t
            scala-auto-start-backend t)

Sometimes I open a file, and everything works well. I get a rich development experience backed by whatever capabilities Metals exposes via LSP. Other times I open it up and it seems that nothing is working, and in the *Messages* buffer I see the likes of:

LSP :: Connected to [metals:38879 status:starting].
LSP :: metals:38879 initialized successfully
LSP :: The request (id: 2, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 4, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 6, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 9, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 11, method: 'textDocument/hover') has been cancelled

As I navigate around the Scala file, that message just spams again and again.

I'm on a Mac running Metals 0.8.0 (though this was also happening on the previous version) with Bloop 1.4.0-RC1 running as a service install installed by brew services start scalacenter/bloop/bloop. I've tried restarting Bloop and it doesn't fix it. I also haven't been able to figure out why it sometimes works, and other times does not.

Of course it is acceptable for requests to get occasionally cancelled, but this seems to be in some genuinely dysfunctional state. When things are working, the Scala experience in Spacemacs is good, but I would like to get that more consistently. How can I get that consistent experience?

4
  • Per this Reddit comment, submitted an issue against lsp-mode on GitHub. Jan 16 '20 at 15:02
  • 1
    After getting some help on Reddit and GitHub, the key here seems to be looking at .metals/metals.log, which is full of errors. That doesn't fix the problem, but it shows that it is likely not an Emacs but a Metals problem, perhaps related to this issue. My investigation is ongoing. Jan 16 '20 at 20:35
  • Update: it seems that it works with Scala 2.12 projects, but not Scala 2.11 projects. Jan 17 '20 at 14:15
  • Same happens to me with Scala 3.0 in build.sbt. Going back to 2.13 fixed this. This is weird.
    – cimentadaj
    Jul 30 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.