Skip to content

Development

Cethric edited this page Apr 11, 2026 · 1 revision

Local Development and Testing

This document provides guidance on building the trainz-language-server from source and configuring it for local development and testing with the LSP4IJ plugin.

Building the Language Server

The trainz-language-server is written in Rust. Ensure you have the Rust toolchain installed.

  1. Navigate to the root of the trainz-language-server repository.
  2. Build the project in release mode to generate the binary:
cargo build --release

The compiled binary will be located at target/release/trainz-language-server.

Local Development with LSP4IJ

To test the language server locally within IntelliJ IDEA using the LSP4IJ plugin:

  1. Install the LSP4IJ Plugin: Ensure the LSP4IJ plugin is installed in your IntelliJ IDEA instance.
  2. Configure the Server:
    • Go to File > Settings > Languages & Frameworks > Language Servers.
    • Add a new language server configuration.
    • Set the Command to the absolute path of your locally built trainz-language-server binary (e.g., /path/to/your/trainz-language-server/target/release/trainz-language-server).
    • Ensure the Extension is set to gs or txt (as appropriate for Trainz files).
  3. Run and Test:
    • Open a Trainz project containing .gs or .txt files in IntelliJ.
    • The LSP4IJ plugin should detect the server configuration and start the language server.
    • You can verify the connection in the IDE logs (usually found in Help > Show Log in Files).

Development Commands

For general development tasks within the trainz-language-server repository:

  • Build: cargo build
  • Test: cargo test
  • Check: cargo check
  • Format: cargo fmt
  • Lint: cargo clippy

Clone this wiki locally