A Rust and Language Server Protocol (LSP) based language server for systemd unit files, providing syntax highlighting, auto-completion, error checking, and more.
- Syntax highlighting for systemd unit files
- Intelligent auto-completion suggestions
- Real-time syntax error checking
- Support for jumping to definitions
- Hover documentation tooltips
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 --release
The compiled binary will be located at target/release/systemd-language-server
.
cargo install systemd-language-server
systemd-language-server
- Install the vscode-languageclient extension
- Configure the systemd-language-server path in settings
Use nvim-lspconfig configuration:
require'lspconfig'.systemd_ls.setup{
cmd = { "systemd-language-server" },
filetypes = { "systemd" },
root_dir = function() return vim.loop.cwd() end
}
You can configure the following options in the .systemd-ls.json
file:
{
"systemd": {
"unitSearchPaths": ["/etc/systemd/system", "/usr/lib/systemd/system"],
"diagnostics": {
"enabled": true
}
}
}
- Rust 1.70+
- tokio async runtime
- tower-lsp library
# Build the project
cargo build
# Run tests
cargo test
# Run linter
cargo clippy
The 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
A simplified integration test is included in tests/integration_tests.rs
. This serves as a placeholder and can be expanded in the future when needed.
To run a specific test:
cargo test --test systemd_unit_tests
To run tests with detailed output:
cargo test -- --nocapture
This 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.