scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metals overrides javaHome in ~/.bloop/bloop.json unconditionally

jackkoenig opened this issue · comments

Describe the bug

The new logic for choosing Java Home in v1.3.0 overrides the version a user may have set in ~/.bloop/bloop.json. In my particular case, I had the home set to use and install of GraalVM JDK 17.0.7 which Metals overwrote to Temurin JDK 17.0.10_7.

Related minor issue, my ~/.bloop/bloop.json had prettier formatting with whitespace whereas metals emits JSON with no whitespace.

Expected behavior

The user should be able to control what JDK Metals and Bloop use, especially on shared compute machines since

  1. The disk space for every user having their own JDK downloaded into their ~/.cache directory starts to add up
  2. Users may not be allowed to download their own JDKs (e.g. on shared corporate machines, academic machines, or super computers)

It may be the case that this should be set differently than ~/.bloop/bloop.json, but it would be ideal to have some way to set it.

Perhaps if Metals (or Bloop) judges that the version is too old, there should be a pop up or error message giving the user instructions on how to proceed (either by manually updating the version, or opting into Metals overriding it by simply deleting the javaHome field from their bloop.json.

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.3.0

Extra context or search terms

No response

Thanks for the report. We don't want to ask the user, since that used to be the logic and it was problematic. The suggested solution is to only override if the major version is too old.