From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#66726: 29.1; Eglot jdtls formatter ignored
Date: Sun, 29 Oct 2023 14:08:21 +0200
Message-ID: <83il6pbphm.fsf@gnu.org>
References: <24934ba0-0577-4a05-bb46-8129982554ea@horstmann.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="3994"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 66726@debbugs.gnu.org
To: Cay Horstmann <cay@horstmann.com>,
 =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@gmail.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 29 13:09:58 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 1qx4cA-0000r2-AE
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Oct 2023 13:09:58 +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 1qx4bj-00046Q-6b; Sun, 29 Oct 2023 08:09:31 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1qx4bh-00045X-P2
 for bug-gnu-emacs@gnu.org; Sun, 29 Oct 2023 08:09:29 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1qx4bh-0005H4-E7
 for bug-gnu-emacs@gnu.org; Sun, 29 Oct 2023 08:09:29 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1qx4cD-0000Xs-Up
 for bug-gnu-emacs@gnu.org; Sun, 29 Oct 2023 08:10:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 29 Oct 2023 12:10:01 +0000
Resent-Message-ID: <handler.66726.B66726.16985813582022@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.16985813582022
 (code B ref 66726); Sun, 29 Oct 2023 12:10:01 +0000
Original-Received: (at 66726) by debbugs.gnu.org; 29 Oct 2023 12:09:18 +0000
Original-Received: from localhost ([127.0.0.1]:40624 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1qx4bW-0000WX-Eb
 for submit@debbugs.gnu.org; Sun, 29 Oct 2023 08:09:18 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57264)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@gnu.org>) id 1qx4bT-0000WI-S0
 for 66726@debbugs.gnu.org; Sun, 29 Oct 2023 08:09:16 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1qx4ar-0005B2-SE; Sun, 29 Oct 2023 08:08:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=JrC/wRNat080FBEaunEpmWYHMGcDXDJpjvg1iKq/sgg=; b=aLdVCRWTmvKamSnQXMnX
 zjBUdfa//V3tQQLQ4d3/Prye7MxzrUs4TF6LiRCrVPoU7rW/0NU1LZs6xVkEtqI4fLjPyKzxGLAD8
 BHJ1txP7B2U3KDz/uQ/T9+plwcjK5obgW8O3EoUga0HmYzITZtiRBg4zXEQ5x8smNhGuMUmwieGQX
 ryfzErXse888rRYh9fJlooRe86wCdFdhCC7LPxj8KBozwAfPgH7nqyyEA44S4hJnVza7NAximhDW0
 BjzbZFJQLMXAe49J/MonxwFhb2aWWJ0GDyco79uZFqM7LvW6mjVZiZzD5E6bFCo9uH7jSxAhXp0r0
 7Z9CzrhJ8uHyVQ==;
In-Reply-To: <24934ba0-0577-4a05-bb46-8129982554ea@horstmann.com> (message
 from Cay Horstmann on Tue, 24 Oct 2023 11:17:09 +0200)
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:273499
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/273499>

> Date: Tue, 24 Oct 2023 11:17:09 +0200
> From: Cay Horstmann <cay@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?