From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#66726: 29.1; Eglot jdtls formatter ignored
Date: Sat, 18 Nov 2023 09:36:01 +0000
Message-ID: <CALDnm50DA+=Mi93nd6--9mD8=70EXYKMz-pfLPXDbq3xr3_NaQ@mail.gmail.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>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="40007"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 66726@debbugs.gnu.org, Cay Horstmann <cay@horstmann.com>
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 18 10:37:25 2023
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 1r4HlU-000AC2-Ic
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Nov 2023 10:37:24 +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 1r4HlI-0005sJ-PE; Sat, 18 Nov 2023 04:37:12 -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 1r4HlA-0005gJ-6R
 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 04:37:04 -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 1r4Hl8-0007Bp-5P
 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 04:37:02 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1r4Hl8-0007v8-Ea
 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 04:37:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=
 <joaotavora@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 18 Nov 2023 09:37:02 +0000
Resent-Message-ID: <handler.66726.B66726.170030018730391@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.170030018730391
 (code B ref 66726); Sat, 18 Nov 2023 09:37:02 +0000
Original-Received: (at 66726) by debbugs.gnu.org; 18 Nov 2023 09:36:27 +0000
Original-Received: from localhost ([127.0.0.1]:47806 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1r4HkY-0007u6-EV
 for submit@debbugs.gnu.org; Sat, 18 Nov 2023 04:36:26 -0500
Original-Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:44179)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@gmail.com>) id 1r4HkS-0007tp-Pw
 for 66726@debbugs.gnu.org; Sat, 18 Nov 2023 04:36:24 -0500
Original-Received: by mail-lf1-x131.google.com with SMTP id
 2adb3069b0e04-507b9408c61so3790040e87.0
 for <66726@debbugs.gnu.org>; Sat, 18 Nov 2023 01:36:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1700300174; x=1700904974; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=2MPZlwXAzI46Z0VCkg7tfrRj15xBxTnnRVRXeRiPPss=;
 b=cGiSoqj2HpnPMlwilcmQ4w1hZzUIQuNLDdbbHuWRt5FUNMJrkmlqtiFS3g1zQ/J02y
 Tfu9hUClePSZAjjwczQkWLF5DdmzHA4PolJiTNtNdIXQRqiv7wLKDJII8/9qKNKzqmV0
 pDdqKJkcpllAGM7H+w8IznX1+UUVA2T4ay+XTghRiCtseM8wZeE9kMGM6oecEasOCAO6
 yXJV+Wx3pIN2KYsOjAKxOFveZcJbsdDJ+EcUf8vL7J3p/wk8nOwmsWk6TsJswlrHbLl/
 JUTShMnqV8eaa4FXD8OK6q5uH0ZyWkYAmKHVD+JhC5bf7MtPLhmg8UWm9aMFADEwg4cW
 +iaw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1700300174; x=1700904974;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=2MPZlwXAzI46Z0VCkg7tfrRj15xBxTnnRVRXeRiPPss=;
 b=vvdqMV1NoYJaoVjgJESQV2xqresmNxeNcybf7s4E6TAXnZJEpG792sWvqpqc9/H+4n
 rVILCGTcz8wHjO8sJgQ2ro82WoCDEVEGaZZ/tddxfoGH9fRjXZfaDuNuqnKrWZa7UdLM
 yzukbcxEeFV0zpw7chi4PJgtRpKQqTvr1gve+/aTTPcCfl5FEWADpwCwrsz4vIHsJ28Y
 m9d10xwLh3MweYjzTuHMtk5neMu1TDXZwAEH6YvmIkmMChtWFal/C2J/u91coa30VP8r
 mSXEiEmPOWPkpq3Kkh4k16y2kQ7aYEuulBNUoxgj2tUrPwjR7ykPH6LLmRbTyHUN8gKZ
 KVhQ==
X-Gm-Message-State: AOJu0YyGpRA7fZKQvQ2kkCKi0L2coOeDw/fzXisplSq2x2s6ocKx771x
 Qyo9DPg1nCtsRx7Zp3kvgBfdfZOylk7mQmyIqb8=
X-Google-Smtp-Source: AGHT+IGXxTFR19/jg4cxHMtOSv+47No2Hz9A8BL4ImuRuIII2XM9Mqb62lz+tspjqONS/NuN8nGfZpyoySPEN3iyMGg=
X-Received: by 2002:a19:f619:0:b0:507:a624:3f35 with SMTP id
 x25-20020a19f619000000b00507a6243f35mr1599134lfe.41.1700300173397; Sat, 18
 Nov 2023 01:36:13 -0800 (PST)
In-Reply-To: <834jhjo3oc.fsf@gnu.org>
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:274542
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/274542>

On Sat, Nov 18, 2023 at 8:40=E2=80=AFAM 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=C3=A3o
> >
> > Hello, here is another stab at this.
> >
> > * There is no problem with that funny looking file:/// URL. jdtls can f=
ind 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 initialization=
Options.settings.java.format.settings.
> >
> > Formatting works fine in VS Code. The logs show requests such as this o=
ne:
> >
> > [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 f=
ormatting directive that follows the formatter, whereas with eglot, the res=
ponse is a directive that follows some default.
> >
> > * Here is the requested eglot-stderr-buffer:
> >
> > WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.f=
oreign
> > Nov 06, 2023 4:20:36 PM org.apache.aries.spifly.BaseActivator log
> > INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServlet=
ContainerInitializer 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.LogbackServiceProv=
ider 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/e=
clipse-jdtls/eclipse.jdt.ls/issues/752#issuecomment-412275314,
> >
> > "Should be in workspace/.metadata/.log, workspace location is a paramet=
er 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/.metada=
ta/.log
> >
> > but they don't contain any info on today's interactions. There is no ot=
her directory in that cache. I can tell from that log that the directory wa=
s passed as a --data command-line argument. But when I intercept jdtls toda=
y via a script to log the command-line args, there is no --data command-lin=
e argument passed when invoking jdtls.
>
> Jo=C3=A3o?

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=C3=A3o