GNU bug report logs - #66726
29.1; Eglot jdtls formatter ignored

Previous Next

Package: emacs;

Reported by: Cay Horstmann <cay <at> horstmann.com>

Date: Tue, 24 Oct 2023 13:22:02 UTC

Severity: normal

Found in version 29.1

Full log


Message #26 received at 66726 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Cay Horstmann <cay <at> horstmann.com>
Cc: 66726 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#66726: 29.1; Eglot jdtls formatter ignored
Date: Mon, 8 Jan 2024 11:37:57 +0000
On Sun, Jan 7, 2024 at 9:40 AM Cay Horstmann <cay <at> horstmann.com> wrote:

> I was asked to reference the discussion on https://github.com/joaotavora/eglot/discussions/1222#discussioncomment-7683229

Yes, thank you for doing so.

> I reported that
>
> (remove-hook 'eglot-connect-hook 'eglot-signal-didChangeConfiguration)
>
> makes the formatter work. João Távora commented that this prevents Eglot from atomatically sending project-specific configuration to *any* server.
>
> I am unsure what the effects of that would be, but I gather from João's comment that it is not an acceptable solution.

It might not be acceptable for all users, yes.  It may be acceptable for you.

Here's a summary of this issue as I understand it:

1. jdtls's support for custom formatters can be achieved by passing suitable
   LSP :initializationOptions

2. According to you, jtdls's support for custom formatters _cannot_
   be achieved with LSP workspaceConfiguration.  It _has_ to use 1.

3. In jdtls, a blank LSP workspaceConfiguration request overwrites any
   settings passed in LSP initializationOptions.  This was confirmed
   by more than one user, I think.

2 and 3 dictate that, barring any changes on the jdtls side, the only
way to use custom formatters in Eglot is for Eglot to not send
LSP workspaceConfiguration to this server at all.  Has jdtls been made
aware of this conflict between 2 and 3?

You may also want to try the less intrusive:

(add-hook 'java-mode-hook (lambda ()
   (remove-hook 'eglot-connect-hook 'eglot-signal-didChangeConfiguration t))

To do it just for java-mode.  If you're using java-ts-mode, you need a similar
incantation, unless some java-base-mode exists (it exists for some Emacs
modes, not sure if Java)

João




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.