GNU bug report logs -
#66726
29.1; Eglot jdtls formatter ignored
Previous Next
Full log
Message #8 received at 66726 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 24 Oct 2023 11:17:09 +0200
> From: Cay Horstmann <cay <at> horstmann.com>
>
> Eglot does not trigger a custom formatter with jdtls, while lsp-java and VS Code with the Red Hat Java plugin can do this. See https://github.com/joaotavora/eglot/discussions/1222 for more background.
>
> I attach files
> * eglot-debug.el (the minimal configuration to see the failure)
> * NotHelloWorld.java (a sample Java file)
> * cay-eclipse-formatter.xml (the formatting rules for jdtls)
> * eglot-events.txt (the events log from eglot)
> * lsp-java-debug.el (the minimal configuration to see how it works with lsp-java)
> * lsp-log.txt (the log from the successful run with lsp)
>
> Download jdtls from https://download.eclipse.org/jdtls/snapshots/?d. I
> have the version from Oct. 14, 2023. Put it somewhere on your PATH
>
> Put the NotHelloWorld.java file in some directory (I use /tmp/hello)
>
> Put the cay-eclipse-formatter.xml file somewhere and adjust the path in eglot-debug.el and lsp-java-debug.el.
>
> emacs -q -l eglot-debug.el /tmp/hello/NotHelloWorld.java
>
> M-x eglot RET
>
> Wait for jdtls to start
>
> M-x eglot-format-buffer RET
>
> The formatting should now use the rules in the cay-eclipse-formatter.xml
> file, resulting in 8 changes but the same Allman indentation
> style. Instead, it uses a K&R indentation style.
>
> To see the proper formatting, install lsp-mode and lsp-java and start with lsp-java-debug.el. Or use VS Code with the Red Hat Java plugin and the settings.json
>
> {
> "java.format.settings.url": "file:///data/cay/bin/cay-eclipse.formatter.xml",
> "java.format.settings.profile": "cay"
> }
João, any comments?
This bug report was last modified 1 year and 162 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.