eglot
eglot copied to clipboard
Bad qoutes on java arguments
From the documentation on the eclipse repository, the following parameters can be used to start the Java language server
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 \
-Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar \
./path/to/eclipse.equinox.jar -configuration \
./path/to/config_{linux,windows,macos}
After adding the init code, it results in the Java arguments being quoted
(add-to-list 'eglot-server-programs '(java-mode . ("java" "...")))
;; Results in error in mini-buffer with message
;; java "..."
This also makes it difficult to use :autoport
since it has to be concatenated to the command,
due to Java's command argument processing. It has to be address=port_number
instead of address= port_number
. Should not be a hard fix, but I do not know enough elisp at the moment.
Pinging @mkcms here.
Are we talking about an alternative to the built-in java init that ships with eglot
? I hope so. Because if we are, then it's very simple to turn the above command into a nicer-behaving bash script and stash it somewhere. Then you should be able to use :autoport
cleanly.
```shell
After adding the init code, it results in the Java arguments being quoted
(add-to-list 'eglot-server-programs '(java-mode . ("java" "..."))) ;; Results in error in mini-buffer with message ;; java "..."
Please post the entire error message here.
This also makes it difficult to use
:autoport
since it has to be concatenated to the command,
Do you mean you have to put the port number in a specific place in the command, rather than just appending it?
The emacs config (copied from a text terminal):
(setq package-archives
'(("gnu" . "http://mirrors.163.com/elpa/gnu/")
("melpa" . "https://melpa.org/packages/")
("org" . "http://orgmode.org/elpa/")))
;; plugins/org.eclipse.equinox.launcher_1.5.400.v20190515-0925.jar
(add-to-list 'eglot-server-programs '(java-mode . ("java" "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.ls.core.\
id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar /home/zugzwang-alt/jdt/plugins/org.eclipse.equinox\
.launcher_1.5.400.v20190515-0925.jar -configuration /home/zugzwang-alt/jdt/config_linux")))
After visiting a Java project and activating eglot by C-u M-x eglot
I get this message in the minibuffer
Enter program to execute (or <host>:<port>): java "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dos\
gi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar /home/zugzwang-alt/jdt/plugins/org.eclipse.equinox.launche\
r_1.5.400.v20190515-0925.jar -configuration /home/zugzwang-alt/jdt/config_linux"
if I hit enter, then I get error in process sentinel: [eglot] -1: Server died
since I assume the Java command is being passed the arguments with quotes, which will error. If I delete the quotes, the server connects just fine.
Pinging @mkcms here.
Are we talking about an alternative to the built-in java init that ships with
eglot
? I hope so. Because if we are, then it's very simple to turn the above command into a nicer-behaving bash script and stash it somewhere. Then you should be able to use:autoport
cleanly.
Yes, a script to retrieve the latest milestone build and let the user choose a directory, probably ~/.emacs.d/
to store the language server should be simple to do.
@juergenhoetzel Could you open this as a pull request? Thanks!