From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Cay Horstmann <cay@horstmann.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#66726: 29.1; Eglot jdtls formatter ignored
Date: Sun, 7 Jan 2024 16:39:56 +0700
Message-ID: <9bba987f-774e-444d-ac50-19ced52698c6@horstmann.com>
References: <24934ba0-0577-4a05-bb46-8129982554ea@horstmann.com>
 <83il6pbphm.fsf@gnu.org>
 <CALDnm53x+Z_ATXrbn+FX=zAY5otySajcu2dctn29CPJ+3PZNqg@mail.gmail.com>
 <b52b69c8-047e-478f-9dba-e1d88a2ad9a8@horstmann.com> <834jhjo3oc.fsf@gnu.org>
 <CALDnm50DA+=Mi93nd6--9mD8=70EXYKMz-pfLPXDbq3xr3_NaQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="35556"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Mozilla Thunderbird
Cc: 66726@debbugs.gnu.org
To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@gmail.com>,
 Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 07 10:41:17 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rMPed-00093u-Km
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Jan 2024 10:41:16 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1rMPeN-0006NR-9k; Sun, 07 Jan 2024 04:40:59 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rMPeK-0006NH-Q7
 for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 04:40:56 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rMPeK-0006QQ-IQ
 for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 04:40:56 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rMPeP-0006Jc-VA
 for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 04:41:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Cay Horstmann <cay@horstmann.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 07 Jan 2024 09:41:01 +0000
Resent-Message-ID: <handler.66726.B66726.170462041724213@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 66726
X-GNU-PR-Package: emacs
Original-Received: via spool by 66726-submit@debbugs.gnu.org id=B66726.170462041724213
 (code B ref 66726); Sun, 07 Jan 2024 09:41:01 +0000
Original-Received: (at 66726) by debbugs.gnu.org; 7 Jan 2024 09:40:17 +0000
Original-Received: from localhost ([127.0.0.1]:60646 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rMPdg-0006IS-S2
 for submit@debbugs.gnu.org; Sun, 07 Jan 2024 04:40:17 -0500
Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:36883)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cay@horstmann.com>) id 1rMPde-0006ID-A2
 for 66726@debbugs.gnu.org; Sun, 07 Jan 2024 04:40:14 -0500
Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id 64FE432009F9;
 Sun,  7 Jan 2024 04:40:02 -0500 (EST)
Original-Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Sun, 07 Jan 2024 04:40:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=horstmann.com;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm1;
 t=1704620401; x=1704706801; bh=dNtOtNcOsAE3n89Upqirsq6SLkt0I7Bd
 v25IDMD7+QM=; b=Jj8uWjJwhvXqRDJ+Tm571H8zOHsPQxbbq3Z0CsrC8x6Yngp4
 ejZjMT45dYD1KcogQMyeYoOt3PHOoCfI6voSRnGxtvdbXRwB9SzoMLtlIjdmGq25
 ydc/hVNsk3DHDNHiCzW0tVsQmuv651moRhG7IB1vDYPqnbcL1PMNNTuA+H9RPxkk
 k9oY89reyu1mvp3Lo4cBeZXOme47WmX8n1pTG0ypVIkbs0w9P/wVZzs6x5eJIa2q
 t82576zzoIx/T9dgHDNY00S+jPe8MA0qMLQwaI/r691z+ftxvFoBmsLdq75D7Tfv
 19D0E2uKkjMdain7v/lroCAKn1ZTlev0iruMTA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704620401; x=
 1704706801; bh=dNtOtNcOsAE3n89Upqirsq6SLkt0I7Bdv25IDMD7+QM=; b=K
 Dp2/ZrjTZoYWoyn6TFmb8K47wYMoDV4L33k9WQzhyylIKFkeOPSCTkovFZXBNIq1
 MrfUHCy0HfTg2P9ZQRrVuA8dkTDvPSMj71NnAv+Pm6EBeYwLatdwVzOELm6LrE5i
 0nxxr/GuHU1HjXlLUySgRKJFxdbUvvy1cqSVC38lDl1rK/BvkAssdnaeTTn/bT5+
 4VJhJDJAsgC8pQ17zr2eAyqSMWGL9+tYvD+Bc1Im4SfRhXvRnnqwQuj8Cbj4ezMR
 9PSX/q8H+u5qP5h6KzW+QXpV3oX7A8GluKMW5OaGdb4Gn3ovTcFj4pYljylMPsyt
 bUjFlQnoHdt/zlionSpMw==
X-ME-Sender: <xms:cXGaZfwkXJpEaq6OrVR9OeC3Q6OMxdMMnPt2iB5oeOywuFfHV9vZUA>
 <xme:cXGaZXRDvGozNwx2LeDaYxngN5VgLMtyxTeyYeFgEPDsxUKZrr6SqyojkLJD_bsKQ
 pZLC5VIn0dK1D4kwQ>
X-ME-Received: <xmr:cXGaZZVIE1XYqTlZ2O4SEEsI3LRTkQsp7AetWO_ZtzWcqhu6SmXcb5KqWVPt2SWcn5o>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehfedgtdekucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeevrgih
 ucfjohhrshhtmhgrnhhnuceotggrhieshhhorhhsthhmrghnnhdrtghomheqnecuggftrf
 grthhtvghrnhepuefhlefftdefjeejffdvieeivdeutdeigfeludehgffgjefftdeiffei
 ffetjeeunecuffhomhgrihhnpehsvghtthhinhhgshdrjhgrvhgrpdhgihhthhhusgdrtg
 homhdpjhguthdrlhhspdhhohhrshhtmhgrnhhnrdgtohhmnecuvehluhhsthgvrhfuihii
 vgeptdenucfrrghrrghmpehmrghilhhfrhhomheptggrhieshhhorhhsthhmrghnnhdrtg
 homh
X-ME-Proxy: <xmx:cXGaZZgxq_BavMusLTBq6pQIXNKvQnxjw1ymSg4kRfuGnFbbo2YWpg>
 <xmx:cXGaZRBy1gtubhVePbugnh7tst64pUMdSYcDOiBJpzR15u7B7sKFCQ>
 <xmx:cXGaZSKNbzxBSTy0u-Kiu8Qs8v9tiPkzBXrumPina5MzBcVU8QrRnw>
 <xmx:cXGaZe7XLQgJ1-1e7-tkoZkUuMtEc1qjHQIabWNIZp5fRFHvGsjDWQ>
Feedback-ID: if99043a1:Fastmail
Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 7 Jan 2024 04:39:59 -0500 (EST)
Content-Language: en-US
In-Reply-To: <CALDnm50DA+=Mi93nd6--9mD8=70EXYKMz-pfLPXDbq3xr3_NaQ@mail.gmail.com>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:277500
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/277500>



On 18/11/2023 16.36, João Távora wrote:
> On Sat, Nov 18, 2023 at 8:40 AM Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> Date: Mon, 6 Nov 2023 18:16:01 +0100
>>> From: Cay Horstmann <cay@horstmann.com>
>>> Cc: 66726@debbugs.gnu.org
>>>
>>>> Cay, is there some kind of jtdls error log where it reports
>>>> things?  Can you also attach the Eglot stderr buffer, in case
>>>> it has something useful?  Use `M-x eglot-stderr-buffer`.
>>>>
>>>> The only thing that seems to be missing is the Emacs version,
>>>> but I'll assume it's the version used in M-x report-emacs-bug
>>>> itself, which is 29.1.
>>>>
>>>> João
>>>
>>> Hello, here is another stab at this.
>>>
>>> * There is no problem with that funny looking file:/// URL. jdtls can find it when invoked from VS Code and lsp-mode.
>>>
>>> * I attach the initialization that happens from VS Code. It looks just like the one that I am setting up in eglot. Look at the path initializationOptions.settings.java.format.settings.
>>>
>>> Formatting works fine in VS Code. The logs show requests such as this one:
>>>
>>> [Trace - 3:51:32 PM] Sending request 'textDocument/formatting - (71)'.
>>> Params: {
>>>       "textDocument": {
>>>           "uri": "file:///tmp/test/NotHelloWorld.java"
>>>       },
>>>       "options": {
>>>           "tabSize": 4,
>>>           "insertSpaces": true
>>>       }
>>> }
>>>
>>> These look just like the ones that eglot sends. But the response is a formatting directive that follows the formatter, whereas with eglot, the response is a directive that follows some default.
>>>
>>> * Here is the requested eglot-stderr-buffer:
>>>
>>> WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
>>> Nov 06, 2023 4:20:36 PM org.apache.aries.spifly.BaseActivator log
>>> INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
>>> Nov 06, 2023 4:20:36 PM org.apache.aries.spifly.BaseActivator log
>>> INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
>>>
>>> * Yes, it is Emacs 29.1.
>>>
>>> * The jdtls logs are a mystery to me. According to https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/752#issuecomment-412275314,
>>>
>>> "Should be in workspace/.metadata/.log, workspace location is a parameter you pass when starting the server."
>>>
>>> Who is "you"? I suppose the client, i.e. eglot or VS Code. I find files such as
>>>
>>> ./eglot-java-eclipse-jdt-cache/a397d9cc217eb5e87ff722051c2f059b/.metadata/.log
>>>
>>> but they don't contain any info on today's interactions. There is no other directory in that cache. I can tell from that log that the directory was passed as a --data command-line argument. But when I intercept jdtls today via a script to log the command-line args, there is no --data command-line argument passed when invoking jdtls.
>>
>> João?
> 
> The way I see it, this seems to be mostly a Jdtls problem, with lots
> of Java world infrastructure details.
> 
> We'd need someone with Elisp and Java expertise (and respective
> toolchains) to reproduce this, and I only have the former.
> 
> Can, since you do program Java, can you try to attach a debugger
> or do some printf debugging or follow the code paths in Jdtls
> to see why it  isn't using the "file:///data/cay/bin/cay-eclipse.formatter.xml"
> file that (as we've already established) Eglot is sending it
> (or at least attempting to send)?
> 
> Anway I'll give it a shot using a VM I sed for reproducing a Tramp/Eglot
> problem a while ago.  No promises though, the setup overhead
> is large here.
> 
> João

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

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.

Cay

-- 

--

Cay S. Horstmann | http://horstmann.com | mailto:cay@horstmann.com