Skip to content

feat: Support stdio transport for GDScript Language Server (LSP) #1156

@MichaelFisher1997

Description

@MichaelFisher1997

The current GDScript Language Server (LSP) implementation in Redot is designed to communicate exclusively over TCP (typically on port 6005). While this works well for standard IDE setups, it presents a challenge for modern automation and integration workflows that expect a subprocess-based interaction model.

Most modern Language Server Protocol (LSP) implementations support communication via stdio (Standard Input/Output). Supporting this transport in Redot would simplify integrations for tools that spawn the engine as a background process to perform language intelligence tasks.

Motivation:

  1. Unified Tooling: Many editor plugins and automation scripts prefer stdio because it avoids the overhead and potential conflicts of managing local network ports (e.g., "Address already in use").
  2. Environment Compatibility: stdio is often more reliable in constrained or virtualized environments (like Docker or Nix shells) where loopback networking might be restricted or require extra configuration.
  3. Performance: For local development tools, communicating over standard streams is low-latency and avoids the TCP stack overhead.

Proposed Solution:
Introduce a new command-line flag: --lsp-stdio.

When launched with this flag, the engine should:

  • Bypass the TCPServer initialization in GDScriptLanguageProtocol.
  • Directly pipe incoming JSON-RPC messages from stdin into the LSP handler.
  • Pipe all LSP responses and notifications to stdout.

Technical Implementation Notes:

  • The logic would likely involve creating a StreamPeer implementation that wraps stdin/stdout or refactoring GDScriptLanguageProtocol to abstract the transport layer beyond StreamPeerTCP.
  • This should ideally work in --headless mode to allow background language processing without a GUI window.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions