JFryy/systemd-lsp: a language server implementation for systemd unit files made in rust 🦀

Date:

Share:

A Language Server Protocol (LSP) implementation for systemd unit files, providing editing support with syntax highlighting, diagnostics, autocompletion, and documentation.

Core Language Server Features

  • Syntax Analysis – Complete parsing of systemd unit file structure
  • Diagnostics – Error detection and validation for sections, directives, directive fields and warnings for non-conventional configurations
  • Autocompletion – Context-aware suggestions for sections and directives
  • Rich Documentation – Comprehensive hover information and goto definition
  • Code Formatting – Formatting of unit files
  • Rust toolchain (install via rustup)
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.

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.

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.

You can run the language server directly, although there is little reason to do so except for debugging purposes. An editor typically starts and stops the server implicitly.

./target/release/systemd-lsp
  • Embedded Documentation – All manual pages built into the binary
  • No External Dependencies – Single binary with everything included
  • Cross-Platform – Works on Linux, macOS, and Windows
  • LSP Standard Compliant – Compatible with all LSP-capable editors

This project is designed to simplify the editing of Unit files by providing validation, autocompletion, and formatting features commonly available for modern languages and file formats. Inspired by systemd-language-server, it offers enhanced functionality and improved performance, leveraging Rust’s memory safety and efficiency.

Contributions always welcome.

Source link

Subscribe to our magazine

━ more like this

PS… – PostSecret

Dear Frank- My wife found my PostSecret that you put up this Sunday and I was a little scared. She cried and told me it...

From Hardware Stores to Fashion—What is the Rope Accessory Trend?

Fashion is always entangled with people’s everyday lives. In a literal sense, this comes down to the way we regularly interact with clothes. But...

Skin microbiome and cosmetics – peppermint oil and hair growth – episode 190

Author: Perry Romanowski Published: July 28, 2019 On this solo episode of the Beauty Brains we cover… Beauty Product Topics Skin Microbiome – Do these beauty products really...

Clockwise #612: Somebody Else’s Problem Field

Support this show Enjoy Clockwise Unwound: Ad-free episodes and an extra Overtime topic every week. #612: Somebody Else's Problem Field July 2nd, 2025 · 29 minutes Whether we’ve secured our...
Previous article