Skip to content

x/tools/gopls: support -remote=auto across CLI subcommands #81721

Open

Description

@hyangah

Currently, gopls CLI subcommands (such as definition, references, check, and
workspace_symbol) run an in-process, single-use LSP session.

-remote=auto allows CLI commands to connect to a shared background daemon,
starting one automatically if none is running.

To support this cleanly, several adjustments to the client/server interaction are
necessary:

• Daemons shut down automatically after an idle period (controlled by -remote.listen.timeout).
• The CLI must properly implement LSP (currently it bypasses some messages, and directly
accesses the handler).
• Different CLI invocations run in different working directories and with different environment
variables (such as GOOS, GOARCH, and GOWORK). The daemon must resolve packages
using the client's working directory (or workspace root) and environment rather than its own
startup state.
• Subcommand-specific option overrides (such as symbol matchers, analyzers, and code lenses)
must propagate to the daemon over the LSP connection.

I was thinking to make this default, but that's too early.
I found -remote=auto isn't working in non-unix platform yet.

Activity

  1. added
    ToolsThis label describes issues relating to any tools in the x/tools repository.
    goplsIssues related to the Go language server, gopls.
    on Sep 24, 2026
  2. added this to the Unreleased milestone on Sep 24, 2026
  3. gopherbot commented on Sep 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/837926 mentions this issue: gopls/internal/cmd: identify gopls cli in LSP initialize

  4. gopherbot commented on Sep 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/837928 mentions this issue: gopls/internal/cmd: propagate client options to server via configuration

  5. gopherbot commented on Sep 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/837927 mentions this issue: gopls/internal/cmd: send Go environment in remote mode initialize

  6. gopherbot commented on Sep 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/837929 mentions this issue: gopls/internal/server: suppress shutdown race when diagnosing orphaned files

  7. gopherbot commented on Sep 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/837925 mentions this issue: gopls/internal/cmd: start a daemon with -remote=auto

  8. self-assigned this
    on Oct 1, 2026
  9. assigned and unassigned on Oct 1, 2026
  10. gopherbot commented on Oct 8, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/847486 mentions this issue: gopls/internal/cmd: separate out client and server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions