Scala/SBT: When Metals plugin doesn’t work in VS Code

I just ran into a situation where the Scala Metals plugin wasn’t working properly in VS Code and my Scala/SBT project. As I researched the problem I ran into this quote from this Github URL:

“Metals should be activated automatically in sbt workspaces.”

I did a lot of things to try to get Metals (and/or Bloop) to “wake up,” and I think the thing I did that made it start working is that I opened my build.sbt file in VS Code, made a minor change to it, saved it, and then clicked “Import build” after that. Really, I did a lot of things, including restarting SBT and VS Code multiple times, so I don’t know for sure that that’s what solved the problem.

Another thing to do is to open up the VS Code console and click the “OUTPUT” tab. That will show information about SBT, Metals, and Bloop. (I think a key to solving this problem may be knowing what that output looks like when everything is working well, versus when it is not working.)

If you’re having problems where the Metals plugin isn’t working with VS Code in your Scala/SBT project, I hope this is helpful, especially that Github link.