A pre-alpha Rust language server for systemd unit files.
- Full-document synchronization with version tracking
- Syntax and section diagnostics with accurate UTF-16 ranges
- Section, directive, and selected value completions
- Hover documentation for common sections and directives
- Recognition of common unit types and
.d/*.confdrop-ins
Go-to-definition, runtime configuration, and semantic highlighting are planned but are not implemented yet. TextMate syntax highlighting remains the responsibility of the editor extension.
You can download pre-built binaries for various platforms from the GitHub Releases page.
Ensure you have the Rust toolchain installed, then run:
git clone https://github.com/10fish/systemd-language-server-rs.git
cd systemd-language-server-rs
cargo build --releaseThe compiled binary will be located at target/release/systemd-language-server.
cargo install systemd-language-serversystemd-language-serverAn official VS Code extension is not available yet. The server can be used through an extension or client that supports configuring an arbitrary stdio language server.
Start the server from a systemd file buffer with Neovim's built-in LSP client:
vim.lsp.start({
name = "systemd-language-server",
cmd = { "systemd-language-server" },
root_dir = vim.fn.getcwd(),
})Runtime configuration is not implemented in the current pre-alpha release.
- Rust 1.85+ (edition 2024)
- tokio async runtime
- tower-lsp library
# Build the project
cargo build
# Run tests
cargo test
# Run linter
cargo clippyThe project includes several types of tests to ensure code quality and functionality:
Unit tests verify the core functionality of parsing and validating systemd unit files:
tests/systemd_unit_tests.rs: Tests for various systemd unit file types (service, socket, timer, mount)tests/diagnostics_tests.rs: Tests for error detection and validation
tests/integration_tests.rs drives the server through JSON-RPC and covers document open/change/close, diagnostics, completion, and hover.
To run a specific test:
cargo test --test systemd_unit_testsTo run tests with detailed output:
cargo test -- --nocaptureThis project uses GitHub Actions for continuous integration and deployment:
- CI Workflow: Runs tests, linting, and code coverage on every push and pull request
- Release Workflow: Automatically builds and publishes binaries for multiple platforms when a new tag is pushed
To create a new release:
- Update the version in
Cargo.toml - Commit the changes
- Create and push a new tag:
git tag v0.1.0 git push origin v0.1.0
- The GitHub Actions workflow will automatically build and publish the release
Pull Requests and Issues are welcome! Please ensure:
- Add tests for new features
- Update documentation
- Follow the project's code style
This project is licensed under the MIT License - see the LICENSE file for details.