diff --git a/README.md b/README.md index 59320f27..82f6d566 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d | Svelte | tailwindcss-intellisense | Yes | Yes | | Svelte | biome | Yes | Yes | | Swift | sourcekit-lsp | Yes | No | +| systemd | systemd-lsp | UNIX Only | Yes | | SystemVerilog | verible-verilog-ls | UNIX Only | Yes | | SystemVerilog | svls | Yes | Yes | | TeX | texlab | Yes | Yes | diff --git a/installer/install-systemd-lsp.sh b/installer/install-systemd-lsp.sh new file mode 100755 index 00000000..950b05a8 --- /dev/null +++ b/installer/install-systemd-lsp.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +os=$(uname -s | tr "[:upper:]" "[:lower:]") +arch="$(uname -m)" + +case $os in +linux) + if [ "$arch" = "x86_64" ]; then + file="systemd-lsp-x86_64-unknown-linux-gnu" + else + echo "unknown architecture: $arch" + exit 1 + fi + ;; +darwin) + if [ "$arch" = "x86_64" ]; then + file="systemd-lsp-x86_64-apple-darwin" + elif [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then + file="systemd-lsp-aarch64-apple-darwin" + else + echo "unknown architecture: $arch" + exit 1 + fi + ;; +*) + echo "unknow platform: $os" + exit 1 + ;; +esac + +curl -L -o "systemd-lsp" "https://github.com/JFryy/systemd-lsp/releases/download/v2025.07.10/$file" + +chmod +x systemd-lsp diff --git a/settings.json b/settings.json index f3a7c4bd..cd1c46aa 100644 --- a/settings.json +++ b/settings.json @@ -1800,6 +1800,14 @@ } } ], + "systemd": [ + { + "command": "systemd-lsp", + "url": "https://github.com/JFryy/systemd-lsp", + "description": "a language server implementation for systemd unit files made in rust 🦀", + "requires": [] + } + ], "systemverilog": [ { "command": "verible-verilog-ls", diff --git a/settings/systemd-lsp.vim b/settings/systemd-lsp.vim new file mode 100644 index 00000000..fb4917f0 --- /dev/null +++ b/settings/systemd-lsp.vim @@ -0,0 +1,18 @@ +augroup vim_lsp_settings_system_lsp + au! + LspRegisterServer { + \ 'name': 'systemd-lsp', + \ 'cmd': {server_info->lsp_settings#get('systemd-lsp', 'cmd', [lsp_settings#exec_path('systemd-lsp')]+lsp_settings#get('systemd-lsp', 'args', []))}, + \ 'root_uri':{server_info->lsp_settings#get('systemd-lsp', 'root_uri', lsp_settings#root_uri('systemd-lsp'))}, + \ 'initialization_options': lsp_settings#get('systemd-lsp', 'initialization_options', { + \ 'completion': { + \ 'autoimport': { 'enable': v:true }, + \ }, + \ }), + \ 'allowlist': lsp_settings#get('systemd-lsp', 'allowlist', ['systemd']), + \ 'blocklist': lsp_settings#get('systemd-lsp', 'blocklist', []), + \ 'config': lsp_settings#get('systemd-lsp', 'config', lsp_settings#server_config('systemd-lsp')), + \ 'workspace_config': lsp_settings#get('systemd-lsp', 'workspace_config', {}), + \ 'semantic_highlight': lsp_settings#get('systemd-lsp', 'semantic_highlight', {}), + \ } +augroup END