Show HN: A Language Server Implementation for SystemD Unit Files

https://news.ycombinator.com/rss Hits: 6
Summary

A Language Server Protocol (LSP) implementation for systemd unit files, providing editing support with syntax highlighting, diagnostics, autocompletion, and documentation. Features Core Language Server Features Syntax Analysis - Complete parsing of systemd unit file structure - Complete parsing of systemd unit file structure Diagnostics - Error detection and validation for sections, directives, directive fields and warnings for non-conventional configurations - Error detection and validation for sections, directives, directive fields and warnings for non-conventional configurations Autocompletion - Context-aware suggestions for sections and directives - Context-aware suggestions for sections and directives Rich Documentation - Comprehensive hover information and goto definition - Comprehensive hover information and goto definition Code Formatting - Formatting of unit files Installation Prerequisites Rust toolchain (install via rustup) Building from source git clone https://github.com/jfryy/systemd-lsp.git cd systemd-lsp cargo build --release The binary will be available at target/release/systemd-lsp . Compilation The project is built using Cargo, Rust's package manager. The --release flag optimizes the build for performance. For development, you can use cargo build for faster compilation times with debug information. Usage Neovim Add this configuration to your Neovim setup: -- Automatically set filetype and start LSP for specific file patterns vim . api . nvim_create_autocmd ( " BufEnter " , { pattern = " *.service " , callback = function () vim . bo . filetype = " systemd " vim . lsp . start ({ name = ' systemd_ls ' , cmd = { ' /path/to/systemd-lsp ' }, -- Update this path to your systemd-lsp binary root_dir = vim . fn . getcwd (), }) end , }) Replace /path/to/systemd-lsp with the actual path to your built binary. Manual execution You can run the language server directly, although there is little reason to do so except for debugging purposes. An editor typically st...

First seen: 2025-07-07 04:25

Last seen: 2025-07-07 10:26