Skip to content

Commit

Permalink
Support specifying extra VM arguments for the Java Language server
Browse files Browse the repository at this point in the history
* eglot.el (eglot-java-vmargs): New defcustom.
(eglot-eclipse-jdt): Specify VM arguments.
  • Loading branch information
zbelial committed Jan 14, 2022
1 parent b928aba commit fe07910
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fe07910

Please sign in to comment.