[2.x] fix: Start server when explicitly requested via BSP/thin client#8529
Merged
eed3si9n merged 1 commit intosbt:developfrom Jan 14, 2026
Merged
[2.x] fix: Start server when explicitly requested via BSP/thin client#8529eed3si9n merged 1 commit intosbt:developfrom
eed3si9n merged 1 commit intosbt:developfrom
Conversation
Fixes sbt#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.
Contributor
Author
|
@eed3si9n please review the PR when you are available. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: sbt -bsp exits silently when autoStartServer := false
Problem
When users set
autoStartServer := falsein their build configuration, runningsbt -bsp(used by IntelliJ for BSP project import) would silently exit without starting the server. This made it impossible to import projects in IntelliJ when this setting was enabled, with no obvious error message to indicate what went wrong.This was particularly frustrating because:
autoStartServerwas the culpritRoot Cause
The
autoStartServersetting was being checked even when the server was explicitly requested via the--serverflag (which BSP mode uses internally). The original logic inCommandExchange.run()was:This meant that when
autoStartServer := false, the server would never start - even when explicitly requested by a remote client like IntelliJ's BSP integration.Solution
The fix distinguishes between automatic and explicit server startup. When sbt is started by a remote client (BSP or thin client via
--serverflag), the server now starts regardless of theautoStartServersetting:This preserves the intended behavior of
autoStartServer:false, sbt won't automatically start a server during normal interactive use--server), the server starts as expectedTesting
Terminal.startedByRemoteClientflag is already used elsewhere in the codebase for similar purposesRelated
Fixes #7481
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147