From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#70614: Wrong simple imenu definition for java Date: Mon, 29 Apr 2024 22:06:30 -0700 Message-ID: <80AE11C5-BE51-461C-B53D-4FB64BA05876@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\)) 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="31219"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , 70614@debbugs.gnu.org To: Benjamin Leis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 30 07:08:18 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 1s1fiz-0007qq-Ol for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 30 Apr 2024 07:08:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1fiY-0007qf-ED; Tue, 30 Apr 2024 01:07:50 -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 1s1fiQ-0007oa-5D for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2024 01:07:42 -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 1s1fiP-00051y-TJ for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2024 01:07:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s1fij-0000SB-UQ for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2024 01:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Apr 2024 05:08:01 +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.17144536341716 (code B ref 70614); Tue, 30 Apr 2024 05:08:01 +0000 Original-Received: (at 70614) by debbugs.gnu.org; 30 Apr 2024 05:07:14 +0000 Original-Received: from localhost ([127.0.0.1]:59087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1fhx-0000Rc-Fr for submit@debbugs.gnu.org; Tue, 30 Apr 2024 01:07:13 -0400 Original-Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:60651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1fhs-0000LY-7r for 70614@debbugs.gnu.org; Tue, 30 Apr 2024 01:07:11 -0400 Original-Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e5c7d087e1so45389975ad.0 for <70614@debbugs.gnu.org>; Mon, 29 Apr 2024 22:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714453602; x=1715058402; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OmO5+yZw3bzFyoWnaQYznLKIKEFnwxP5V88mmjA78Gs=; b=ZyJhGhK6wdN++z42428F0MSoq33GHfeJFC9ObxqzGZvG4hLuEqv4XzomShCBXNUN0W 2SYVhoe/zYiWEyIWgJzJo/vmnBS07liDUrML62+n5edt5QIFnU1EkecR1iHRraffu9rm efVZy/CGhzZOksf3SnXFOjx1YkdLjCurQFsffl0kHf0FQptSd//+DsB1UAem5wkhCL11 8c+6MXWP3ANGIa7/YpsYcFSqeAs1EUhjzyoVOSEQfGkl5XOrq9OyHLr79vmUrZn4hiZs pjQDoaiSYa1wR8BhL+EKJ7Y10X90buLon9sz7CtxzeFujsU+AjSqwe/84gpTmPAT8O2D DMVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714453602; x=1715058402; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OmO5+yZw3bzFyoWnaQYznLKIKEFnwxP5V88mmjA78Gs=; b=O1C/escfduTJK0d3jPwq4oaWRqKILNeh3AvsHjlF0UquSDy7Si49/eUPbyzagaQT/P 7ZOT1xxo7c5piakE66FwRQOzpW1TpKC+g+lki7EowUry39GzTIdT75rBPCt7MVrlyGFK yOiF1J+d/IPc21Dq39XZii7frZbMzuh90bCWaYAoY3QxA2sAC0f7WE1HPxgh1hHeZ5uP WTRItNgjc1WrbdYKsgx4wzPPh61oB9Xy1Gmw+H6khxxJsIzeJOL6k6XEgk+4nlQ/DXrr oXWpMkTUQXoDU03sqN64gXQ2ulSU4RAfSPTvUiAUi/DTVoR37lTzhUoZdhrjA/Y1/BTJ a/0Q== X-Gm-Message-State: AOJu0YwkAqY8SUSgHDNnYzzPBMS3mqYv97u4OOZV0tn4fC27SZiI0Dqh dWVXA+UsRCBHEXWLc4zhwUw60/SynFn8WHhI6PdsU28IYU27TLGQ X-Google-Smtp-Source: AGHT+IHAtl7RQz0W91blv7rjlt35r00BC0Bpe+a7v8JbQJA4ndFVmcGXMCTQ7/cfEtXHRaNmkAZtHw== X-Received: by 2002:a17:902:f548:b0:1eb:519e:e05f with SMTP id h8-20020a170902f54800b001eb519ee05fmr10799033plf.45.1714453601856; Mon, 29 Apr 2024 22:06:41 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:641:300:4910:f9ed:3ba9:7e02:f6eb]) by smtp.gmail.com with ESMTPSA id f14-20020a170902ce8e00b001eb51a46f5bsm5494068plg.43.2024.04.29.22.06.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2024 22:06:41 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3731.700.6.1.1) 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:284184 Archived-At: > On Apr 27, 2024, at 11:45 AM, Benjamin Leis via Bug reports for GNU = Emacs, the Swiss army knife of text editors = wrote: >=20 > I noticed the treesitter imenu definitions for java in java-ts-mode.el = have 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_ba= sed_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-tree. 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 buffer, and go through the returned = tree to convert nodes into imenu labels. Also CCing Theo; Theo, WDYT? Yuan=