scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.1k stars 334 forks source link

"The build server has not responded in over 1 minute" keeps happening #5674

Closed pawelprazak closed 12 months ago

pawelprazak commented 1 year ago

Describe the bug

This message keep popping up no matter what:

Screenshot 2023-09-25 at 09 24 55

Unfortunately I don't know how to reproduce the problem.

I've tried clicking all of the options here, but no luck:

Screenshot 2023-09-25 at 09 31 01

I've set the scala-cli path explicitly, but this didn't help as well.

VSCode Version: 1.82.2 Metals: v1.25.0 Scala CLI version: 1.0.4 Scala version (default): 3.3.0

The BSP file:

{
  "name": "scala-cli",
  "argv": [
    "/usr/local/bin/scala-cli",
    "bsp",
    "--json-options",
    "/Users/pprazak/repos/besom-tutorial/.scala-build/ide-options-v2.json",
    "/Users/pprazak/repos/besom-tutorial"
  ],
  "version": "1.0.4",
  "bspVersion": "2.1.0-M5",
  "languages": [
    "scala",
    "java"
  ]
}

Am I doing something wrong or this is a bug?

Expected behavior

  1. I expect the build server to not crash so often
  2. I expect metals to automatically restart it if it crashed
  3. I expect clear and actionable instructions if manual action is required on how to restart the server

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.25.0

Extra context or search terms

No response

kasiaMarek commented 1 year ago

Can you tell me what version of metals server are you using (you can find it in metals doctor)? We had an issue with that feature incorrectly reporting "no response". Could you try switching to a pre-release version of metals and seeing if that keeps happening? Also an action to restart the server was added to the popup.

pawelprazak commented 1 year ago

Are those the versions that will help?

Metals Doctor
Metals Java: 17.0.8.1 from Homebrew located at /usr/local/Cellar/openjdk@17/17.0.8.1/libexec/openjdk.jdk/Contents/Home

Metals Server version: 1.0.1

Below are listed the build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.

Build definition is coming from scala-cli.

Build server currently being used is scala-cli v1.0.4.
kasiaMarek commented 1 year ago

Metals Server version was the one I was interested in, thank you. So, as I said, there was a fix concerning this issue after the 1.0.1 release. So could you check if you still experience the problem if you switch to the pre-release version?

pawelprazak commented 1 year ago

Thank you! I've switched to pre-release and will post here if this happens again.

hedefalk commented 1 year ago

Having similar issues last couple of days. I've always been running sbt on terminal off to the side as I found that to be working best, but now I can't get it to work at all.

At first sbt hanged a lot with: sbt server is running 'bspBuildTargetSources file:/Users/viktor/dev/XXXXX enter 'cancel' to stop evaluation

Dunno how to "enter 'cancel'" and I have to kill it.

This happened more and more often until I now started to try to fix it.

Tried to upgrade to 1.0.1+80-something reading the above but then I get:

sbt does not support buildTarget/inverseSources and I get nothing in vscode. [info] welcome to sbt 1.9.6 (Azul Systems, Inc. Java 17.0.8.1)

Downgraded again, tried pre-release of vscode plugin and back, but now I'm entirely stuck at this. I just get:

sbt does not supportbuildTarget/inverseSources, unable to fetch targets owning source.`` and then no build target for: [current-file]´

which I think is what makes nothing work at all.

tgodzik commented 1 year ago

bt does not support buildTarget/inverseSources, unable to fetch targets owning source.`` and then no build target for: [current-file]´

it's just a warning, nothing is being sent to sbt in that case, we should be able to get the build target based on the data that sbt provides us, but it seems it's unable to do so for the file you are looking into. If sbt hangs at bspBuildTargetSources this might be a reason for not recognizing files as belonging to specific module/target.

kasiaMarek commented 12 months ago

This seems to no longer be an issue after fixes (https://github.com/scalameta/metals/pull/5608, https://github.com/scalameta/metals/pull/5716), also this information was moved to a status https://github.com/scalameta/metals/pull/5660.