From fe07910823bd4a1bdc1cd05f168fd9f2a53aa5c6 Mon Sep 17 00:00:00 2001 From: zbelial Date: Fri, 14 Jan 2022 15:48:25 +0800 Subject: [PATCH] Support specifying extra VM arguments for the Java Language server * eglot.el (eglot-java-vmargs): New defcustom. (eglot-eclipse-jdt): Specify VM arguments. --- eglot.el | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/eglot.el b/eglot.el index b97e3a4e..28e1e483 100644 --- a/eglot.el +++ b/eglot.el @@ -3005,6 +3005,15 @@ If NOERROR, return predicate, else erroring function." ;;; eclipse-jdt-specific ;;; +(defcustom eglot-java-vmargs '("-XX:+UseParallelGC" "-XX:GCTimeRatio=4" "-XX:AdaptiveSizePolicyWeight=90" "-Dsun.zip.disableMemoryMapping=true" "-Xmx1G" "-Xms100m") + "Specifies extra VM arguments used to launch the Java Language Server. + +Eg. use `-noverify -Xmx1G -XX:+UseG1GC +-XX:+UseStringDeduplication` to bypass class +verification,increase the heap size to 1GB and enable String +deduplication with the G1 Garbage collector" + :type '(repeat string)) + (defclass eglot-eclipse-jdt (eglot-lsp-server) () :documentation "Eclipse's Java Development Tools Language Server.") @@ -3083,13 +3092,14 @@ If INTERACTIVE, prompt user for details." (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))))) + `(,(executable-find "java") + "-Declipse.application=org.eclipse.jdt.ls.core.id1" + "-Dosgi.bundles.defaultStartLevel=4" + "-Declipse.product=org.eclipse.jdt.ls.core.product" + ,@eglot-java-vmargs + "-jar" ,jar + "-configuration" ,config + "-data" ,workspace))))) (cl-defmethod eglot-execute-command ((_server eglot-eclipse-jdt) (_cmd (eql java.apply.workspaceEdit)) arguments)