This is a proof of concept implementation of a server implementing the Language Server Protocol for RPM Spec files.
Please share your feature requests with us by opening an issue, creating a discussion or chat with us on matrix in #rpm-spec-language-server:matrix.org.
- autocompletion of macro names, spec sections and preamble keywords
- jump to macro definition
- expand macros on hover
- breadcrumbs/document sections
- Python >= 3.11
- poetry
- Install the dependencies via
poetry install
- Launch the server in tcp mode (binds to
`127.0.0.1:2087
by default) viapoetry run rpm_lsp_server
Alternatively, you can build the python package, install the wheel and run the module directly:
poetry build
pip install --user dist/rpm_spec_language_server-*.whl
python -m rpm_spec_language_server
The server requires the spec.md
file. It can either use the locally installed copy from the rpm
package or
(if the documentation has not been installed) from a locally cached version in
~/.cache/rpm/spec.md
.
A very simple VSCode client is available in clients/vscode/
. Building
requires nodejs and the npm
package manager:
$ npm install
$ npm run package
Install the created rpm-spec-language-server-$VERSION.vsix
and launch
the language server in tcp mode.
vis with vis-lspci
Add to your ~/.config/vis/visrc.lua this code:
lsp = require('plugins/vis-lspc')
lsp.ls_map['rpmspec'] = {
name = 'RPMSpec',
cmd = 'python3 -mrpm_spec_language_server --stdio'
}
local lspconfig = require("lspconfig")
local util = require("lspconfig.util")
local configs = require("lspconfig.configs")
configs.rpmspec = {
default_config = {
cmd = { 'python3', '-mrpm_spec_language_server', '--stdio' },
filetypes = { 'spec' },
single_file_support = true,
root_dir = util.find_git_ancestor,
settings = {},
},
docs = {
description = [[
https://github.com/dcermak/rpm-spec-language-server
Language server protocol (LSP) support for RPM Spec files.
]],
},
}
lspconfig["rpmspec"].setup({})
Neovim with coc.nvim plugin
Warning
coc.nvim is licensed under the non-free "activist" Anti 996 License
Open nvim, run :CocConfig
, and merge the following JSON into your
configuration
{
"languageserver": {
"spec": {
"command": "rpm_lsp_server",
"args": ["--stdio"],
"filetypes": ["spec"]
}
}
}
Emacs with lsp-mode.el
lsp-mode
has builtin support for the rpm-spec-language-server. All you have
to do is to require 'lsp-rpm-spec
and launching lsp-mode
. With
use-package
, this can be implemented as follows utilizing rpm-spec-mode
:
(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred)
:hook ((rpm-spec-mode . lsp-deferred)))
(use-package rpm-spec-mode
:ensure t
:mode "\\.spec'"
:config (require 'lsp-rpm-spec))