Skip to content
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
65d0e05
feat(`systemd_lsp`): Add important root markers
kris3713 Dec 20, 2025
2492b06
feat(`systemd_lsp`): Remove wildcard globs from root_markers
kris3713 Dec 20, 2025
904510b
Merge branch 'neovim:master' into systemd_lsp
kris3713 Dec 20, 2025
a3d36d9
feat(`systemd_lsp`): Testing `root_dir = vim.fn.getcwd()`
kris3713 Dec 21, 2025
f1c405d
feat(`systemd_lsp`): Testing solution made by AI (Google Gemini)
kris3713 Dec 21, 2025
e5919e1
feat(`systemd_lsp`): Add type annotations
kris3713 Dec 21, 2025
e0576d7
feat(`systemd_lsp`): Updated documentation to include advanced config…
kris3713 Dec 21, 2025
0209cd7
feat(`systemd_lsp`): Updated documentation
kris3713 Dec 21, 2025
267ce5e
Merge pull request #1 from kris3713/systemd_lsp-patch
kris3713 Dec 21, 2025
5b1ca9e
Merge branch 'neovim:master' into systemd_lsp
kris3713 Dec 21, 2025
3223d46
Merge branch 'neovim:master' into systemd_lsp
kris3713 Dec 23, 2025
3cf2bcb
Merge branch 'neovim:master' into systemd_lsp
kris3713 Dec 24, 2025
522b85c
Merge branch 'neovim:master' into systemd_lsp
kris3713 Dec 26, 2025
c412472
fix(systemd_lsp): replace `root_dir` function with `root_pattern` table
kris3713 Dec 30, 2025
ab162cf
fix(systemd_lsp): Simplify root_dir function, and make use of root_pa…
kris3713 Dec 30, 2025
663ebed
fix(systemd_lsp): Correct documentation
kris3713 Dec 30, 2025
47b0d43
fix(systemd_lsp): Fix code style to avoid stylua linting errors
kris3713 Dec 30, 2025
4c36f50
fix(systemd_lsp): Fix code style to avoid stylua linting errors again
kris3713 Dec 30, 2025
e79cb63
fix(systemd_lsp): Replaced autocmd with `vim.filetype.add()` for syst…
kris3713 Dec 30, 2025
95ea893
fix(systemd_lsp): Fix code style to avoid stylua linting errors again
kris3713 Dec 30, 2025
0ce16ea
fix(systemd_lsp): Fix slight error in documentation
kris3713 Dec 30, 2025
9d252ce
Merge branch 'neovim:master' into systemd_lsp
kris3713 Dec 30, 2025
9106a48
Merge branch 'neovim:master' into systemd_lsp
kris3713 Jan 2, 2026
3217dcc
fix(systemd_lsp): Use a table instead of a for each loop
kris3713 Jan 2, 2026
aab5357
fix(systemd_lsp): Refactored comment documentation
kris3713 Jan 2, 2026
a20e83a
fix(systemd_lsp): Fixed documentation
kris3713 Jan 2, 2026
7bb7232
Merge branch 'neovim:master' into systemd_lsp
kris3713 Jan 5, 2026
a0f3ee1
Merge branch 'neovim:master' into systemd_lsp
kris3713 Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions lsp/systemd_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,73 @@
--- ```
---
--- A language server implementation for Systemd unit files made in Rust.
---
--- > [!NOTE]
--- >
--- > If you want this LSP to accurately activate for any
--- > Systemd unit files, use the following settings:
---
--- ```lua
--- vim.filetype.add {
--- extension = {
--- -- systemd unit filetypes
--- service = 'systemd',
--- socket = 'systemd',
--- timer = 'systemd',
--- mount = 'systemd',
--- automount = 'systemd',
--- swap = 'systemd',
--- target = 'systemd',
--- path = 'systemd',
--- slice = 'systemd',
--- scope = 'systemd',
--- device = 'systemd',
--- -- Podman Quadlet filetypes
--- container = 'systemd',
--- volume = 'systemd',
--- network = 'systemd',
--- kube = 'systemd',
--- pod = 'systemd',
--- build = 'systemd',
--- image = 'systemd',
--- },
--- }
--- ```


---@type vim.lsp.Config
return {
cmd = { 'systemd-lsp' },
filetypes = { 'systemd' },
---@param bufnr integer
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)

local systemd_unit_filetypes = { -- Credit to @magnuslarsen
-- systemd unit files
'*.service',
'*.socket',
'*.timer',
'*.mount',
'*.automount',
'*.swap',
'*.target',
'*.path',
'*.slice',
'*.scope',
'*.device',
-- Podman Quadlet files
'*.container',
'*.volume',
'*.network',
'*.kube',
'*.pod',
'*.build',
'*.image',
}

local util = require('lspconfig.util')

on_dir((util.root_pattern(systemd_unit_filetypes))(fname))
end,
}
Loading