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?= Newsgroups: gmane.emacs.bugs Subject: bug#66726: 29.1; Eglot jdtls formatter ignored Date: Sun, 29 Oct 2023 14:40:02 +0000 Message-ID: References: <24934ba0-0577-4a05-bb46-8129982554ea@horstmann.com> <83il6pbphm.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="19913"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66726@debbugs.gnu.org, Cay Horstmann To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 29 15:37:51 2023 Return-path: 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 ) id 1qx6vF-0004qY-Ec for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Oct 2023 15:37:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qx6v1-0002vI-3h; Sun, 29 Oct 2023 10:37:35 -0400 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 ) id 1qx6uz-0002v3-B4 for bug-gnu-emacs@gnu.org; Sun, 29 Oct 2023 10:37:33 -0400 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 ) id 1qx6uw-0002bA-2M for bug-gnu-emacs@gnu.org; Sun, 29 Oct 2023 10:37:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qx6vS-0007RB-AI for bug-gnu-emacs@gnu.org; Sun, 29 Oct 2023 10:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Oct 2023 14:38:02 +0000 Resent-Message-ID: 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.169859027828578 (code B ref 66726); Sun, 29 Oct 2023 14:38:02 +0000 Original-Received: (at 66726) by debbugs.gnu.org; 29 Oct 2023 14:37:58 +0000 Original-Received: from localhost ([127.0.0.1]:42958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx6vN-0007Qr-UW for submit@debbugs.gnu.org; Sun, 29 Oct 2023 10:37:58 -0400 Original-Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]:55301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx6vJ-0007QZ-HX for 66726@debbugs.gnu.org; Sun, 29 Oct 2023 10:37:57 -0400 Original-Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-507a0907896so5171397e87.2 for <66726@debbugs.gnu.org>; Sun, 29 Oct 2023 07:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698590234; x=1699195034; 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=npshCNHRrjQ3icj/hJMUiQ1i8vzUYDSg1S4K+ZyZ1ck=; b=kVGtrQuZSL08DD9YRTb3ovbBZOfUgfMZBkASsM18mZEkwStbDuNjl0Nd+J/YblP5dc XJWWddjSsUZKETsxgUpqwm0DCwLaNtwfH+u5bV4jPLwGl9R7Z9Rg9Nlacl0nGP9FVJp5 5ZDA0cEtlb8l/Ea9DF9SgGd6ySxmfPjG1y9EyTaadMtN+EScIa9UsceNLW3dpfHm2dDm EA514BcTvRerp92X91GVEypyVyneR3q5BAnTZ6B5Tq/gkaK7oa2cslvEf64kAuq8l1fo lL49hTgHSYUIy8a6kKbuzxSNPJAwqzEkgNJzSSQq84vahfltUDNC0jXk6D0gsZ0Njcho DuAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698590234; x=1699195034; 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=npshCNHRrjQ3icj/hJMUiQ1i8vzUYDSg1S4K+ZyZ1ck=; b=g4cxneNPXGHTQahCisldiMQfy8kQKUkVVvI0H5zpZ+aTGOaJoLeidwqNjrazHWSdJ0 Ln6qQtIxeoQSEQJAjhmfylarqIh/6JI9fVM6d3RFJ15l9eE7+wKKSJFYR9ynprNx18bn GsTR0VBnCyugCrUfAF9EjCIJ6IH47YnNSJbOmaUi6wIfeagiFKa+T5G6IM0JJEUb1JFa Z7H+u9oROrlgt03gXQqYTQ78FWtXL1mh0TLoh1yF3kNudSvsJewQglsUwC0AFpGn96cj F275mAfhd05ZCDXk0KU7NWYy/kbFWx2C9URH0vYkBQBfzqnK4pIwZ/6xirj8CVdDmeJS NXBQ== X-Gm-Message-State: AOJu0YwtBACdA2a/YsXcSYE79H3Ijxz8/96KwCZ2vMd7J5UIyFUevweK nGjsbMEWfLBr/TRO2MfOnyVnt6zUFoSxxottOZM= X-Google-Smtp-Source: AGHT+IHifpsQyRBP1ZYyVkpAnxNIOWmbQoJA7aSYaGr7o5k8vYjRrYaasT8LEr43Qglwfr22qW2HHAc4IL6c+bHTcYQ= X-Received: by 2002:a05:6512:2345:b0:507:a766:ad29 with SMTP id p5-20020a056512234500b00507a766ad29mr7068884lfu.12.1698590234172; Sun, 29 Oct 2023 07:37:14 -0700 (PDT) In-Reply-To: <83il6pbphm.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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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:273509 Archived-At: On Sun, Oct 29, 2023 at 12:08=E2=80=AFPM Eli Zaretskii wrote= : > > > Date: Tue, 24 Oct 2023 11:17:09 +0200 > > From: Cay Horstmann > > > > Eglot does not trigger a custom formatter with jdtls, while lsp-java an= d 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.xm= l > > 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 w= ith 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.form= atter.xml", > > "java.format.settings.profile": "cay" > > } > > Jo=C3=A3o, any comments? Not many. Seems like a good error recipe, assuming someone finds the time to reproduce it. If I had to guess, I'd say almost surely a server-side quirk about it not finding the xml file from that slightly strange url. Maybe lsp-mode is setting some environment variable. But that would require me debugging Java which I haven't done in just about 20 years and not really looking forward to. 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