Skip to content

Commit a5f5ca9

Browse files
authored
Add new client: lsp-rpm-spec (#4302)
This client adds support for rpm spec files leveraging https://github.com/dcermak/rpm-spec-language-server
1 parent d324c25 commit a5f5ca9

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* Changelog
22
** Unreleased 8.0.1
3+
* Add support for RPM spec files
34
* Add support for installing lsp dependencies via Cargo.
45
* Fix tramp support issues (see [[https://github.com/emacs-lsp/lsp-mode/pull/4204][#4204]])
56
* Add Cypher support.

clients/lsp-rpm-spec.el

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
;;; lsp-rpm-spec.el --- lsp-mode integration for the rpm-spec-language-server -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2024 emacs-lsp maintainers
4+
5+
;; Author: emacs-lsp maintainers
6+
;; Keywords: lsp, rpm-spec
7+
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
;;; Commentary:
22+
23+
;; LSP Client for RPM Spec files
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
29+
(defgroup lsp-rpm-spec nil
30+
"LSP support for RPM spec files using rpm-spec-language-server."
31+
:group 'lsp-mode
32+
:tag "Language Server"
33+
:link '(url-link "https://github.com/dcermak/rpm-spec-language-server"))
34+
35+
(defcustom lsp-rpm-spec-server-command '("python" "-m" "rpm_spec_language_server" "--stdio")
36+
"Command to start rpm-spec-language-server."
37+
:risky t
38+
:group 'lsp-rpm-spec
39+
:type '(repeat string))
40+
41+
(defun lsp-rpm-spec--install-server (_client callback error-callback update?)
42+
"Install the rpm-spec-language-server via pip.
43+
44+
Will invoke CALLBACK or ERROR-CALLBACK based on result.
45+
If UPDATE? is true, then pip will update the server."
46+
(lsp-async-start-process
47+
callback
48+
error-callback
49+
"pip" "install" "--user" "rpm-spec-language-server" (when update? "-U")))
50+
51+
(lsp-register-client
52+
(make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-rpm-spec-server-command))
53+
:activation-fn (lsp-activate-on "rpm-spec")
54+
:server-id 'rpm-spec-language-server))
55+
56+
(lsp-consistency-check lsp-rpm-spec)
57+
58+
(provide 'lsp-rpm-spec)
59+
60+
;;; lsp-rpm-spec.el ends here

docs/lsp-clients.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,14 @@
827827
"installation": "npm i -g remark-language-server",
828828
"debugger": "Not available"
829829
},
830+
{
831+
"name": "rpm-spec",
832+
"full-name": "RPM Spec",
833+
"server-name": "rpm-spec-language-server",
834+
"server-url": "https://github.com/dcermak/rpm-spec-language-server",
835+
"installation": "pip install --user rpm-spec-language-server",
836+
"debugger": "Not available"
837+
},
830838
{
831839
"name": "rubocop",
832840
"full-name": "Ruby (RuboCop)",

lsp-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ Changes take effect only when a new session is started."
781781
("\\.mdx\\'" . "mdx")
782782
("\\.php$" . "php")
783783
("\\.rs\\'" . "rust")
784+
("\\.spec\\'" . "rpm-spec")
784785
("\\.sql$" . "sql")
785786
("\\.cypher$" . "cypher")
786787
("\\.svelte$" . "svelte")

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ nav:
134134
- R: page/lsp-r.md
135135
- Racket (jeapostrophe): page/lsp-racket-langserver.md
136136
- Racket (Theia): page/lsp-racket-language-server.md
137+
- RPM Spec: page/lsp-rpm-spec.md
137138
- Ruby (RuboCop): page/lsp-rubocop.md
138139
- Ruby (ruby-lsp): page/lsp-ruby-lsp.md
139140
- Ruby (Solargraph): page/lsp-solargraph.md

0 commit comments

Comments
 (0)