-
Notifications
You must be signed in to change notification settings - Fork 276
Open
Labels
Description
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:
- Unified Tooling: Many editor plugins and automation scripts prefer
stdiobecause it avoids the overhead and potential conflicts of managing local network ports (e.g., "Address already in use"). - Environment Compatibility:
stdiois often more reliable in constrained or virtualized environments (like Docker or Nix shells) where loopback networking might be restricted or require extra configuration. - 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
TCPServerinitialization inGDScriptLanguageProtocol. - Directly pipe incoming JSON-RPC messages from
stdininto the LSP handler. - Pipe all LSP responses and notifications to
stdout.
Technical Implementation Notes:
- The logic would likely involve creating a
StreamPeerimplementation that wrapsstdin/stdoutor refactoringGDScriptLanguageProtocolto abstract the transport layer beyondStreamPeerTCP. - This should ideally work in
--headlessmode to allow background language processing without a GUI window.