| Crates.io | systemd-language-server |
| lib.rs | systemd-language-server |
| version | 0.1.0 |
| created_at | 2025-03-07 04:11:18.498373+00 |
| updated_at | 2025-03-07 04:11:18.498373+00 |
| description | A Rust and Language Server Protocol (LSP) based language server for systemd unit files |
| homepage | |
| repository | https://github.com/10fish/systemd-language-server |
| max_upload_size | |
| id | 1582328 |
| size | 76,218 |
English🇺🇸 | ç®€ä½“ä¸æ–‡ðŸ‡¨ðŸ‡³
A Rust and Language Server Protocol (LSP) based language server for systemd unit files, providing syntax highlighting, auto-completion, error checking, and more.
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
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
}
}
}
# 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 validationA 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
Pull Requests and Issues are welcome! Please ensure:
This project is licensed under the MIT License - see the LICENSE file for details.