unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Benjamin Leis <benjamin.leis@servicenow.com>
Cc: Theodor Thornhill <theo@thornhill.no>, 70614@debbugs.gnu.org
Subject: bug#70614: Wrong simple imenu definition for java
Date: Mon, 29 Apr 2024 22:06:30 -0700	[thread overview]
Message-ID: <80AE11C5-BE51-461C-B53D-4FB64BA05876@gmail.com> (raw)
In-Reply-To: <SN6PR08MB5326F17F77FC76AB8E41AD4A8B152@SN6PR08MB5326.namprd08.prod.outlook.com>



> On Apr 27, 2024, at 11:45 AM, Benjamin Leis via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
> 
> 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 “Record” 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_based_imenulist_with_java/

It looks pretty nice, do you want to just put it in Emacs? Also, there’s a chance that your code can be simplified by using treesit-induce-sparse-tree. You can look at treesit-simple-imenu for now it’s 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




  reply	other threads:[~2024-04-30  5:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-27 18:45 bug#70614: Wrong simple imenu definition for java Benjamin Leis via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-30  5:06 ` Yuan Fu [this message]
2024-04-30 16:34   ` Benjamin Leis via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-30 18:30     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-30 20:55       ` Benjamin Leis via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-01  1:10       ` Yuan Fu
2024-05-01 12:00         ` Eli Zaretskii
2024-04-30 18:27   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80AE11C5-BE51-461C-B53D-4FB64BA05876@gmail.com \
    --to=casouri@gmail.com \
    --cc=70614@debbugs.gnu.org \
    --cc=benjamin.leis@servicenow.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).