Fix eglot-java contact settings, and add ability to set java agent
This commit is contained in:
parent
cc4557d6fc
commit
c82bf55102
@ -52,20 +52,28 @@
|
|||||||
`(html-web-mode . ,(eglot-alternatives
|
`(html-web-mode . ,(eglot-alternatives
|
||||||
'(("vscode-html-language-server" "--stdio")
|
'(("vscode-html-language-server" "--stdio")
|
||||||
("html-languageserver" "--stdio")))))
|
("html-languageserver" "--stdio")))))
|
||||||
|
(defvar eglot-java-java-agent nil
|
||||||
|
"Java agent JVM arg for eglot JDTLS.")
|
||||||
;; Custom eglot java server for deeper customization
|
;; Custom eglot java server for deeper customization
|
||||||
(defclass eglot-java-server (eglot-lsp-server) ()
|
(defclass eglot-java-server (eglot-lsp-server) ()
|
||||||
:documentation "Eglot integration with JDTLS.")
|
:documentation "Eglot integration with JDTLS.")
|
||||||
(add-to-list 'eglot-server-programs
|
(defun eglot-java-contact (&optional interactive)
|
||||||
'(java-mode .
|
`(eglot-java-server .
|
||||||
(eglot-java-server .
|
("jdtls" ,(if (s-blank? eglot-java-java-agent)
|
||||||
("jdtls" :initializationOptions
|
""
|
||||||
(:extendedClientCapabilities
|
(format "--jvm-arg=-javaagent:%s" eglot-java-java-agent))
|
||||||
(:classFileContentsSupport t)
|
:initializationOptions
|
||||||
:runtimes [(:name "JavaSE-11"
|
(:extendedClientCapabilities (:classFileContentsSupport t)
|
||||||
:path "/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk")
|
:settings
|
||||||
(:name "JavaSE-17"
|
(:java
|
||||||
:path "/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk"
|
(:home "/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home"
|
||||||
:default t)])))))
|
:configuration
|
||||||
|
(:runtimes [(:name "JavaSE-11"
|
||||||
|
:path "/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk")
|
||||||
|
(:name "JavaSE-17"
|
||||||
|
:path "/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk"
|
||||||
|
:default t)])))))))
|
||||||
|
(add-to-list 'eglot-server-programs '(java-mode . eglot-java-contact))
|
||||||
;; Fix JDTLS's weird handling of workspaceEdit
|
;; Fix JDTLS's weird handling of workspaceEdit
|
||||||
(cl-defmethod eglot-execute-command
|
(cl-defmethod eglot-execute-command
|
||||||
((_server eglot-java-server) (_cmd (eql java.apply.workspaceEdit)) arguments)
|
((_server eglot-java-server) (_cmd (eql java.apply.workspaceEdit)) arguments)
|
||||||
|
Loading…
Reference in New Issue
Block a user