fix: Use sbt script in BSP config instead of hardcoded Java path (#8920)

**Problem**

sbt bspConfig writes the absolute path of the current Java binary into .bsp/sbt.json. When the user switches Java versions (via sdkman, cs java, etc.) or removes that JDK, the IDE fails to start the sbt BSP server because the hardcoded path is stale or gone.

**Solution**

When an sbt launcher script is available (via `sbt.script` system property or PATH lookup), generate:

"argv": ["/path/to/sbt", "bsp"]
This commit is contained in:
BitToby
2026-03-19 20:57:53 -04:00
committed by GitHub
parent f92c06155c
commit be305eb3a5
8 changed files with 68 additions and 32 deletions
@@ -1306,7 +1306,7 @@ object NetworkClient {
case "--sbt-launch-jar" if i + 1 < sanitized.length =>
i += 1
launchJar = Option(sanitized(i).replace("%20", " "))
case "-bsp" | "--bsp" => bsp = true
case "-bsp" | "--bsp" | "bsp" => bsp = true
case "-no-server" | "--no-server" =>
System.setProperty("sbt.server.autostart", "false")
case a if a.startsWith("--autostart=") =>