From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70614: Wrong simple imenu definition for java Date: Tue, 30 Apr 2024 20:27:23 +0200 Message-ID: <87le4uwvsk.fsf@thornhill.no> References: <80AE11C5-BE51-461C-B53D-4FB64BA05876@gmail.com> Reply-To: Theodor Thornhill 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="40137"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70614@debbugs.gnu.org, Benjamin Leis To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 30 20:28:20 2024 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 1s1sDE-000A7d-1V for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 30 Apr 2024 20:28:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1sCz-0005Jd-0P; Tue, 30 Apr 2024 14:28:05 -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 1s1sCc-00055K-7o for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2024 14:27:43 -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 1s1sCb-0002Cs-Qn for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2024 14:27:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s1sCw-000729-FE for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2024 14:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Apr 2024 18:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70614 X-GNU-PR-Package: emacs Original-Received: via spool by 70614-submit@debbugs.gnu.org id=B70614.171450168027031 (code B ref 70614); Tue, 30 Apr 2024 18:28:02 +0000 Original-Received: (at 70614) by debbugs.gnu.org; 30 Apr 2024 18:28:00 +0000 Original-Received: from localhost ([127.0.0.1]:60799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1sCt-00071v-Ip for submit@debbugs.gnu.org; Tue, 30 Apr 2024 14:27:59 -0400 Original-Received: from out-178.mta1.migadu.com ([2001:41d0:203:375::b2]:26082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1sCo-00071p-Hz for 70614@debbugs.gnu.org; Tue, 30 Apr 2024 14:27:58 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1714501646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oS+sfs7PcThUqRmJflb01uZRNJMqrirrcefbGH36nIE=; b=ieZ+J+SQPkKnAKq21N6R/BpnIB4ZHXARnLaR1yiZt1DgKRw5AdgWxii4iVylbi1j+2lTlF ilLxgDiaSyu00m7gMya7xAKYCDll7RqbNAZCMYAcj++kxfG4ctjM2JywKEB/KgAJrLxVlJ dAHwL5d2B/ue48u4iXGq7xlXr4Wl8QCwufyf3xFhsOpQuKMankta/FgwdK6/1N+QIk6qdl a0sWpdvwm89gv6cnsBJP8waLBTjSomICdGA/KZhp43/cEBhiStvgGKE/0Nxjlj1ajoPDvs WFQgYDePHBfDdLfj737/0V4Xz/L/hg8Zs0bJ9ZAOfrLGOKPFP2wX+81U5OgHXg== In-Reply-To: <80AE11C5-BE51-461C-B53D-4FB64BA05876@gmail.com> (Yuan Fu's message of "Mon, 29 Apr 2024 22:06:30 -0700") X-Migadu-Flow: FLOW_OUT 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:284223 Archived-At: Yuan Fu writes: >> On Apr 27, 2024, at 11:45 AM, Benjamin Leis via Bug reports for GNU Emac= s, the Swiss army knife of text editors wrote: >>=20 >> I noticed the treesitter imenu definitions for java in java-ts-mode.el h= ave the following: >> ;; Imenu. >> (setq-local treesit-simple-imenu-settings >> '(("Class" \\`class_declaration\\' nil nil) >> ("Interface" \\`interface_declaration\\' nil nil) >> ("Enum" \\`record_declaration\\' nil nil) >> ("Method" \\`method_declaration\\' nil nil))) >> (treesit-major-mode-setup)) >> The 3rd definition for enums should either be for =E2=80=9CRecord=E2= =80=9D if that was the intention or match against \\`enum_declaration if = it really was meant for enums. >> Ben > > Thanks for reporting that! Is that you who posted this post on reddit? > > https://www.reddit.com/r/emacs/comments/1cej9fr/hierarchical_treesitter_b= ased_imenulist_with_java/ > > It looks pretty nice, do you want to just put it in Emacs? Also, there=E2= =80=99s a > chance that your code can be simplified by using treesit-induce-sparse-tr= ee. You > can look at treesit-simple-imenu for now it=E2=80=99s used. Basically we = use > treesit-induce-sparse-tree to find all the interesting nodes in the buffe= r, and > go through the returned tree to convert nodes into imenu labels. > > Also CCing Theo; Theo, WDYT? I like it - let's get it in :) Theo