From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.help Subject: Re: Editing Java (with LSP) Date: Tue, 14 Jun 2022 22:12:00 +0300 Message-ID: References: <87k09ky8kc.fsf@gmail.com> <87mtegcjhh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7944"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: help-gnu-emacs@gnu.org To: Alessandro Bertulli Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 14 21:13:08 2022 Return-path: Envelope-to: geh-help-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 1o1ByN-0001o8-J8 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 21:13:08 +0200 Original-Received: from localhost ([::1]:41558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1ByM-0004z4-7k for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 15:13:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1BxQ-0004yq-Pa for help-gnu-emacs@gnu.org; Tue, 14 Jun 2022 15:12:09 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:41301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1BxO-0007Sn-Ov for help-gnu-emacs@gnu.org; Tue, 14 Jun 2022 15:12:08 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 15AB15C0197; Tue, 14 Jun 2022 15:12:02 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 14 Jun 2022 15:12:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1655233922; x=1655320322; bh=a91nfFDOfq 5UvbIlWdYjQGLPalmcOLGeMHKghg1+ogE=; b=a4ge3UZEd5IsuTspb1Zs0Dw+jo gPwnuR/9MfFu+ivNg7T3lhsLnO2d0VHEP9CDuIMh3z7FbNrndqLiO3xA44C9wM+A MMPEJk3qDj+TB9LLknAz3IfEStbIl9bxuLy9XS9Z/+l4SNiBPQ35b/qhvLhk9Ohu aVAMmqsSwMc5kWiAUYAaTZluLeydS2YGcJ/2V/8gspDdxY0E3J6QEiahl1rbdbDw IwGQEY7E6VEBXfcXvktXzRi3XxDRxWHG3CWkR6gIUPzEZP5rDnlfkhgjgV5Ko+Jj chsOC9Of6D9jcA2o1hksDbc208tcVEWz0cKA3u3IhBBHrtENC98xkvVme1Rw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1655233922; x=1655320322; bh=a91nfFDOfq5UvbIlWdYjQGLPalmc OLGeMHKghg1+ogE=; b=c0bmMFsHtS+2K27cQq1uCh3tsE/Kg3JHkID+D4se0f3l WaKHRs2IRR6motVcs8s7EnycQu8Dt1PhuJhw0sKNw18VFyrYH7dHk7oaywdLRNeP xSEE1vdeijGIDdueLnuhpFTcupjI4toRDPvx+YwxPfeiGQTmnMxa8SrFYuStNcxl TkhFefS+/GUtjRDEbojKDB03+OwbU16bL1deBWxqQUq1zuhofXnEfEiVbgF5lXas f+KBZ+dOkEjn00r28o97XXP8XNf7JY9HwMfa3j4eZwaP2Q5ih2vhD3elHOK695Ll n9rv4WSYyP0e+SGAL9+uyOBYOGoixXaiZjsVIcL8MA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudduledgudefvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enogfuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefhvfevufgjfhgffffk gggtsehttdertddtredtnecuhfhrohhmpefhihhlihhpphcuifhunhgsihhnuceofhhguh hnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnheptdduhffggeeg heefgefhhfegjefhieetgeeftdduteefhfekjeekjeejueduveevnecuffhomhgrihhnpe hgnhhurdhorhhgpdhgihhthhhusgdrihhonecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepfhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: id48c41f1:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jun 2022 15:12:01 -0400 (EDT) In-Reply-To: <87mtegcjhh.fsf@gmail.com> (Alessandro Bertulli's message of "Mon, 13 Jun 2022 23:53:06 +0200") Mail-Followup-To: Alessandro Bertulli , help-gnu-emacs@gnu.org Received-SPF: pass client-ip=66.111.4.26; envelope-from=fgunbin@fastmail.fm; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:137839 Archived-At: On 13/06/2022 23:53 +0200, Alessandro Bertulli wrote: > Filipp Gunbin writes: > >> That seems to be true. There're very few of us. > Indeed > >> >> I use my package javaimp (http://elpa.gnu.org/packages/javaimp.html), >> it's limited in functionality, but it fits my needs. >> >> Current version knows about the project structure and dependencies (from >> Maven or Gradle), assists with completion in imports, and implements >> imenu better than cc-mode. Next version is almost ready, it has >> improved parsing (for imenu and other stuff), limited xref support >> (finding a definition should work), navigation functions, and a minor >> mode to enable all that. > > Uhm, interesting! I suppose it's a completely stand-alone package, > independent from LSP? Yes, it's independent from LSP. It depends on Maven / Gradle to provide dependency and classpath info, but invokes them as commands. >> Next, I plan to add support for debugging via gud (I already have the >> dependencies info), REPL via jshell (jdk 11), and perhaps implement >> indentation (this will remove dependency on cc-mode). However, I don't >> know when I'll be able to complete all this. > > I have experimented with GUD/RealGUD, but honestly it didn't click in to > me. I felt natural with gdb, but to me the GUD interface with other > debuggers is not as standard as it should be. Let me know if I am naive > here, but: if I can't use the same commands in every debugger, then > whats the point? I think the point is in integration of command-line debugger (jdb in case of Java) with source files in Emacs buffers. > Do you feel good with GUD? Did you have to do any special > configuration? I haven't used gud for a long time now. And back then, I only checked it works. Without automagical feeding it with project sources / classpath, it's almost useless, and I certainly wouldn't do that by hand... >> I don't intend to work on good font-lock support, because I don't use it >> myself, and it would require full source parsing, which is better done >> with treesitter (there's ongoing work on treesitter integration into >> Emacs, hopefully we'll see it soon). Also, clever source completion is >> also not in my plan: for that, you need a compiler, via lsp or directly. > > Yap, I don't know treesitter but I suspect it may be an useful > integration also to solve this problem. Unfortunately, completion is one > of the thing that I find very useful (especially when exploring a new > codebase/library/framework, having type-checked completion is really > like having a guide, and it reduces basic, dumb errors) Tree-sitter is an efficient parser library, see https://tree-sitter.github.io/tree-sitter/. However, for good completion, I suspect you'd still have to resort to LSP. Filipp