How to update jdtls automatically? #1366
-
How to update jdtls automatically without downloading manually every time or use magic numbers in the code? my settings:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unless using an auxiliary package (e.g., eglot-java), you'll need to write custom code.
You could take inspiration from (use-package eglot
:config
(add-to-list 'eglot-server-programs
'(java-mode . ("~/jdt-language-server")))
(setq eglot-autoshutdown t)
:hook
(java-mode . francesco/java-eglot-ensure) ;; https://download.eclipse.org/jdtls/milestones/?d
(js-mode . eglot-ensure) ;; npm install -g typescript-language-server typescript
)
(defun francesco/java-eglot-ensure ()
"This function installs or upgrades automatically jdtls"
;; If the jdtls server installation folder doesn't exist at ~/jdt-language-server
;; - Lookup the latest jdtls milestone download URL from somewhere
;; - Download the jdtls tarball
;; - Extract the tarball to ~/jdt-language-server and record somewhere the installed version
;; - Remove the downloaded jdtls tarball
;; Otherwise we check for new updates, if we haven't checked yet for a week....
;; if the latest recorded version by me somewhere in a file is not the latest
;; - Download jdtls to a temporary folder similarly to the regular installation
;; - Delete the old installation folder
;; - Rename the temporary folder to the installation folder
;;
;; Call eglot-ensure now
) In |
Beta Was this translation helpful? Give feedback.
Unless using an auxiliary package (e.g., eglot-java), you'll need to write custom code.
eglot-java
the initial jdtls installation is performed automatically on your behalfYou could take inspiration from
eglot-java
and wrapeglot-ensure
with your own function forjava-mode
(e.g.,francesco/java-eglot-ensure
). You probably don't want to check all the time for new versions in the context of "automatic updates" (performance, your ip address will also likely be blocked for abuse...).