[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/eglot2emacs 77f3157dcd 048/120: Use new jdtls script for eclipse
From: |
João Távora |
Subject: |
feature/eglot2emacs 77f3157dcd 048/120: Use new jdtls script for eclipse jdt |
Date: |
Thu, 20 Oct 2022 07:16:52 -0400 (EDT) |
branch: feature/eglot2emacs
commit 77f3157dcd2926ded5a04069ef44242b3c27a2a5
Author: Manuel Uberti <manuel.uberti@inventati.org>
Commit: GitHub <noreply@github.com>
Use new jdtls script for eclipse jdt
Per https://github.com/joaotavora/eglot/issues/864.
* eglot.el (eglot-server-programs): use new jdtls
(eglot--eclipse-jdt-contact, eglot--eclipse-jdt). Remove.
(eglot-execute-command eglot-eclipse-jdt): Remove.
(eglot-initialization-options eglot-eclipse-jdt): Remove.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/863
---
lisp/progmodes/eglot.el | 96 +------------------------------------------------
1 file changed, 1 insertion(+), 95 deletions(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index b84e1449d7..5b4d419678 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -173,7 +173,7 @@ language-server/bin/php-language-server.php"))
(go-mode . ("gopls"))
((R-mode ess-r-mode) . ("R" "--slave" "-e"
"languageserver::run()"))
- (java-mode . eglot--eclipse-jdt-contact)
+ (java-mode . ("jdtls"))
(dart-mode . ("dart_language_server"))
(elixir-mode . ("language_server.sh"))
(ada-mode . ("ada_language_server"))
@@ -3014,100 +3014,6 @@ If NOERROR, return predicate, else erroring function."
`(,self () (re-search-forward ,(concat "\\=" arg)) (,next)))
-;;; eclipse-jdt-specific
-;;;
-(defclass eglot-eclipse-jdt (eglot-lsp-server) ()
- :documentation "Eclipse's Java Development Tools Language Server.")
-
-(cl-defmethod eglot-initialization-options ((server eglot-eclipse-jdt))
- "Passes through required jdt initialization options."
- `(:workspaceFolders
- [,@(cl-delete-duplicates
- (mapcar #'eglot--path-to-uri
- (let* ((root (project-root (eglot--project server))))
- (cons root
- (mapcar
- #'file-name-directory
- (append
- (file-expand-wildcards (concat root "*/pom.xml"))
- (file-expand-wildcards (concat root
"*/build.gradle"))
- (file-expand-wildcards (concat root
"*/.project")))))))
- :test #'string=)]
- ,@(if-let ((home (or (getenv "JAVA_HOME")
- (ignore-errors
- (expand-file-name
- ".."
- (file-name-directory
- (file-chase-links (executable-find "javac"))))))))
- `(:settings (:java (:home ,home)))
- (ignore (eglot--warn "JAVA_HOME env var not set")))))
-
-(defun eglot--eclipse-jdt-contact (interactive)
- "Return a contact for connecting to eclipse.jdt.ls server, as a cons cell.
-If INTERACTIVE, prompt user for details."
- (cl-labels
- ((is-the-jar
- (path)
- (and (string-match-p
- "org\\.eclipse\\.equinox\\.launcher_.*\\.jar$"
- (file-name-nondirectory path))
- (file-exists-p path))))
- (let* ((classpath (or (getenv "CLASSPATH") path-separator))
- (cp-jar (cl-find-if #'is-the-jar (split-string classpath
path-separator)))
- (jar cp-jar)
- (dir
- (cond
- (jar (file-name-as-directory
- (expand-file-name ".." (file-name-directory jar))))
- (interactive
- (expand-file-name
- (read-directory-name
- (concat "Path to eclipse.jdt.ls directory (could not"
- " find it in CLASSPATH): ")
- nil nil t)))
- (t (error "Could not find eclipse.jdt.ls jar in CLASSPATH"))))
- (repodir
- (concat dir
- "org.eclipse.jdt.ls.product/target/repository/"))
- (repodir (if (file-directory-p repodir) repodir dir))
- (config
- (concat
- repodir
- (cond
- ((string= system-type "darwin") "config_mac")
- ((string= system-type "windows-nt") "config_win")
- (t "config_linux"))))
- (workspace
- (expand-file-name (md5 (project-root (eglot--current-project)))
- (locate-user-emacs-file
- "eglot-eclipse-jdt-cache"))))
- (unless jar
- (setq jar
- (cl-find-if #'is-the-jar
- (directory-files (concat repodir "plugins") t))))
- (unless (and jar (file-exists-p jar) (file-directory-p config))
- (error "Could not find required eclipse.jdt.ls files (build
required?)"))
- (when (and interactive (not cp-jar)
- (y-or-n-p (concat "Add path to the server program "
- "to CLASSPATH environment variable?")))
- (setenv "CLASSPATH" (concat (getenv "CLASSPATH") path-separator jar)))
- (unless (file-directory-p workspace)
- (make-directory workspace t))
- (cons 'eglot-eclipse-jdt
- (list (executable-find "java")
- "-Declipse.application=org.eclipse.jdt.ls.core.id1"
- "-Dosgi.bundles.defaultStartLevel=4"
- "-Declipse.product=org.eclipse.jdt.ls.core.product"
- "-jar" jar
- "-configuration" config
- "-data" workspace)))))
-
-(cl-defmethod eglot-execute-command
- ((_server eglot-eclipse-jdt) (_cmd (eql java.apply.workspaceEdit)) arguments)
- "Eclipse JDT breaks spec and replies with edits as arguments."
- (mapc #'eglot--apply-workspace-edit arguments))
-
-
;;; Obsolete
;;;
- feature/eglot2emacs 46a480aa88 072/120: Fix egregious thinko in eglot--uri-to-path, (continued)
- feature/eglot2emacs 46a480aa88 072/120: Fix egregious thinko in eglot--uri-to-path, João Távora, 2022/10/20
- feature/eglot2emacs f8c8c70f8a 077/120: Reduce eldoc noise from hover messages, João Távora, 2022/10/20
- feature/eglot2emacs 9ffcd537f8 078/120: Apply any additionaltextedits unconditionally, João Távora, 2022/10/20
- feature/eglot2emacs b931d93b15 085/120: Guess the "lsp identifier at point", João Távora, 2022/10/20
- feature/eglot2emacs e5b021c01f 095/120: Fix jdtls support, João Távora, 2022/10/20
- feature/eglot2emacs a598352750 104/120: Allow eglot-workspace-configuration to be a plist, João Távora, 2022/10/20
- feature/eglot2emacs b633c29648 112/120: Rename "eglot -> eglot" in docstrings, João Távora, 2022/10/20
- feature/eglot2emacs 5b902b5cbb 110/120: Add support for "single server, multiple modes", João Távora, 2022/10/20
- feature/eglot2emacs 4071eaf8ad 116/120: * eglot.el (version): actually bump to 1.9, João Távora, 2022/10/20
- feature/eglot2emacs 9801e217f9 118/120: Rework header of eglot.el, João Távora, 2022/10/20
- feature/eglot2emacs 77f3157dcd 048/120: Use new jdtls script for eclipse jdt,
João Távora <=
- feature/eglot2emacs 349f6b5f78 050/120: Don't advertise didchangewatchedfiles on tramp, João Távora, 2022/10/20
- feature/eglot2emacs 965e1378f1 053/120: Use bounds of thing at point when asking for code actions, João Távora, 2022/10/20
- feature/eglot2emacs a38ce8b28f 052/120: Add simple support for workspacefolders, João Távora, 2022/10/20
- feature/eglot2emacs cb562118cb 047/120: Don't strip invisible text when formatting hover string, João Távora, 2022/10/20
- feature/eglot2emacs 904556f662 058/120: Easier initializationoptions in eglot-server-programs, João Távora, 2022/10/20
- feature/eglot2emacs 49e56e47d8 066/120: Solve flymake diagnostics synchronization problems, João Távora, 2022/10/20
- feature/eglot2emacs 917e8ffa31 080/120: Add support for jedi-language-server, João Távora, 2022/10/20
- feature/eglot2emacs 9dbc18cbfa 084/120: Tweak some details, fix some bugs, João Távora, 2022/10/20
- feature/eglot2emacs 2a12f622dc 087/120: Eglot-workspace-configuration can be a function, João Távora, 2022/10/20
- feature/eglot2emacs 1986c4df88 089/120: Reply more reasonably to server's workspace/applyedit, João Távora, 2022/10/20