scalameta / metals

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

SBT clashes with Bloop in Scala 3 #6723

Open filipwiech opened 2 weeks ago

filipwiech commented 2 weeks ago

Describe the bug

Related to the old comment from a different issue (initially I thought it was caused by the new Best Effort compilation mode): https://github.com/scalameta/metals/issues/6628#issuecomment-2259853185.

After our project migrated to Scala 3 (there was never such problem with Scala 2) I noticed that Bloop builds triggered by Metals (by changing code in the editor) started to break external SBT builds for the same project that I run in the terminal (for example to execute tests). Usually it doesn't happen immediately, but after a while SBT starts throwing "fake" errors and is unable to do anything (compile, test, etc.) without a clean build. This helps for a bit, until the whole thing starts again.

It seems that IntelliJ has a special setting just for this issue, called "Use separate compiler output paths" (see related SCL-22359). Does Metals or Bloop allow for something similar? Could it be made available as a simple single-switch option, maybe even enabled out of the box for Bloop (the default Metals build server)? :slightly_smiling_face:

Scala 3.5.0, SBT 1.10.1, Bloop 2.0.0.

Expected behavior

Both SBT (external terminal) and Bloop (editor with Metals) builds can work concurrently in the same project without any conflicts.

Operating system

Linux

Editor/Extension

Other

Version of Metals

1.3.5+74-424c00f8-SNAPSHOT

Extra context or search terms

No response

tgodzik commented 2 weeks ago

Thanks for reporting! sbt and Bloop actually have separate output paths. Bloop produces things to client directories in .bloop, while sbt uses specific target. I don't think it's possible that they interfere with each other.

You can confirm by running the doctor and clicking on a specific target, then scrolling to:

image

Or alternatively, you can turn off sbt, do some changes and see if the sbt target directory changed at all