Allow configurable port range for the SonarLint Embedded Server to support multi-user remote environ

Problem Description
Currently, the SonarLint Language Server (LSP) starts an embedded HTTP server to enable the “Open in IDE” feature from the SonarQube/SonarCloud interface. This server attempts to bind to a fixed range of ports: 64120 to 64130.

While this works perfectly for local development, it creates a significant bottleneck in shared remote development environments (e.g., a large Linux server accessed via VS Code Remote-SSH, or shared development VMs).

In scenarios where more than 11 developers are working on the same host simultaneously, the port range is exhausted. Subsequent users cannot start the embedded server, effectively breaking the “Open in IDE” functionality for a large portion of the team.

Technical Context
The limitation is hardcoded in the EmbeddedServer.java file within the sonarlint-core backend:

  • File: org.sonarsource.sonarlint.core.embedded.server.EmbeddedServer

  • Constants: STARTING_PORT = 64120 and ENDING_PORT = 64130

Proposed Solution
I propose making this port range configurable rather than hardcoded. This would allow system administrators or developers to define a wider range or a specific offset for their environment.

I suggest providing configuration through one of the following methods (in order of preference):

  1. VS Code Settings: A new setting like sonarlint.embeddedServer.portRange (e.g., "64120-64200").

  2. Environment Variables: Support for SONARLINT_SERVER_PORT_START and SONARLINT_SERVER_PORT_END.

  3. System Properties: Allowing a -Dsonarlint.server.ports=... flag.

Impact

  • Improved Scalability: Supports large teams working on centralized development infrastructure.

  • Flexibility: Avoids conflicts with other services that might be camping on those specific ports in restricted corporate networks.

  • Consistency: Ensures the “Open in IDE” feature remains reliable regardless of the number of concurrent users on a host.

Thank you @David_Suarez for raising this limitation. We will review with the team how feasible it is to open up configuration for custom port ranges and see if we can enable more users per instance. As of now our LSP is not built for usage in “shared” infrastructure, for that we have MCP server. Will keep you posted.