[2.x] fix: Start server when explicitly requested via BSP/thin client (#8529)

Fixes #7481

When sbt is started by a remote client (BSP or thin client via --server flag),
always start the server regardless of autoStartServer setting. The autoStartServer
setting is meant for automatic server startup, not for blocking explicit server
start requests.
This commit is contained in:
MkDev11 2026-01-14 04:57:05 -05:00 committed by GitHub
parent 7b33362245
commit f85ced45f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -153,7 +153,8 @@ private[sbt] final class CommandExchange {
def run(s: State): State = run(s, s.get(autoStartServer).getOrElse(true))
def run(s: State, autoStart: Boolean): State = {
if (autoStartServerSysProp && autoStart) runServer(s)
val startedByRemote = Terminal.startedByRemoteClient
if (autoStartServerSysProp && (autoStart || startedByRemote)) runServer(s)
else s
}
private[sbt] def setState(s: State): Unit = lastState.set(s)