Skip to content

Commit 70877e4

Browse files
authored
lsp-xml: Allow automatic download of Lemminx (LSP XML) server (#2264)
* lsp-xml: Allow automatic download of Lemminx (LSP XML) server - Add helper constants to reduce repetition of current version. - Store jar in `lsp-server-install-dir` * lsp-xml: update github location, installation docs
1 parent 9116389 commit 70877e4

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Add Racket support.
99
* Provided automatic installers for `lsp-clojure` (`clojure-lsp`).
1010
* Added ~lsp-modeline-workspace-status-mode~ and option to disable it via ~lsp-modeline-workspace-status-enable~.
11+
* Automatically download [[https://github.com/eclipse/lemminx][XML language server Lemminx]]
1112
** Release 7.0.1
1213
* Introduced ~lsp-diagnostics-mode~.
1314
* Safe renamed ~lsp-flycheck-default-level~ -> ~lsp-diagnostics-flycheck-default-level~

clients/lsp-xml.el

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,32 @@ Newlines and excess whitespace are removed."
182182
("xml.catalogs" lsp-xml-catalogs)
183183
("xml.trace.server" lsp-xml-trace-server)))
184184

185-
(defcustom lsp-xml-jar-file (expand-file-name
186-
(locate-user-emacs-file
187-
"org.eclipse.lsp4xml-0.3.0-uber.jar"))
185+
(defconst lsp-xml-jar-version "0.13.1")
186+
187+
(defconst lsp-xml-jar-name (format "org.eclipse.lemminx-%s-uber.jar" lsp-xml-jar-version))
188+
189+
(defcustom lsp-xml-jar-file (f-join lsp-server-install-dir "xmlls" lsp-xml-jar-name)
188190
"Xml server jar command."
189191
:type 'string
190192
:group 'lsp-xml
191193
:type 'file
192194
:package-version '(lsp-mode . "6.1"))
193195

196+
(defcustom lsp-xml-jar-download-url
197+
(format
198+
"https://repo.eclipse.org/content/repositories/lemminx-releases/org/eclipse/lemminx/org.eclipse.lemminx/%s/%s"
199+
lsp-xml-jar-version
200+
lsp-xml-jar-name)
201+
"Automatic download url for lsp-xml."
202+
:type 'string
203+
:group 'lsp-xml
204+
:package-version '(lsp-mode . "7.1"))
205+
194206
(lsp-dependency
195207
'xmlls
196208
'(:system lsp-xml-jar-file)
197-
`(:download :url "https://repo.eclipse.org/content/repositories/lemminx-releases/org/eclipse/lemminx/org.eclipse.lemminx/0.13.1/org.eclipse.lemminx-0.13.1-uber.jar"
198-
:store-path ,(f-join lsp-server-install-dir "xmlls" "org.eclipse.lemminx.jar")))
209+
`(:download :url lsp-xml-jar-download-url
210+
:store-path lsp-xml-jar-file))
199211

200212
(defcustom lsp-xml-server-command `("java" "-jar" ,lsp-xml-jar-file)
201213
"Xml server command."
@@ -216,7 +228,9 @@ Newlines and excess whitespace are removed."
216228
:server-id 'xmlls
217229
:initialized-fn (lambda (workspace)
218230
(with-lsp-workspace workspace
219-
(lsp--set-configuration (lsp-configuration-section "xml"))))))
231+
(lsp--set-configuration (lsp-configuration-section "xml"))))
232+
:download-server-fn (lambda (_client callback error-callback _update?)
233+
(lsp-package-ensure 'xmlls callback error-callback))))
220234

221235
(provide 'lsp-xml)
222236
;;; lsp-xml.el ends here

docs/lsp-clients.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@
542542
"name": "xml",
543543
"full-name": "XML",
544544
"server-name": "lsp4xml",
545-
"server-url": "https://github.com/angelozerr/lsp4xml",
546-
"installation": "Download from lsp4xml releases",
545+
"server-url": "https://github.com/eclipse/lemminx",
546+
"installation": "Automatic by lsp-mode",
547547
"debugger": "Not available"
548548
},
549549
{

0 commit comments

Comments
 (0)