GNU bug report logs - #70614
Wrong simple imenu definition for java

Previous Next

Package: emacs;

Reported by: Benjamin Leis <benjamin.leis <at> servicenow.com>

Date: Sat, 27 Apr 2024 22:28:01 UTC

Severity: normal

Tags: pending

To reply to this bug, email your comments to 70614 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Sat, 27 Apr 2024 22:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Benjamin Leis <benjamin.leis <at> servicenow.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 27 Apr 2024 22:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Benjamin Leis <benjamin.leis <at> servicenow.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Wrong simple imenu definition for java
Date: Sat, 27 Apr 2024 18:45:10 +0000
[Message part 1 (text/plain, inline)]
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\\'</%60class_declaration/'> nil nil)
                ("Interface" \\`interface_declaration\\'</%60interface_declaration/'> nil nil)
                ("Enum" \\`record_declaration\\'</%60record_declaration/'> nil nil)
                ("Method" \\`method_declaration\\'</%60method_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</%60enum_declaration>   if it really was meant for enums.

Ben
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Tue, 30 Apr 2024 05:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Benjamin Leis <benjamin.leis <at> servicenow.com>
Cc: Theodor Thornhill <theo <at> thornhill.no>, 70614 <at> debbugs.gnu.org
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Mon, 29 Apr 2024 22:06:30 -0700

> 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 <at> 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



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Tue, 30 Apr 2024 17:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Benjamin Leis <benjamin.leis <at> servicenow.com>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Theodor Thornhill <theo <at> thornhill.no>,
 "70614 <at> debbugs.gnu.org" <70614 <at> debbugs.gnu.org>
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Tue, 30 Apr 2024 16:34:32 +0000
[Message part 1 (text/plain, inline)]
Hi Yuan
Yes it was me that posted on reddit. I’ll look into the sparse tree method – that looks promising.  I’d be happy to add into the tree. What would the process be for that?
Ben

From: Yuan Fu <casouri <at> gmail.com>
Date: Monday, April 29, 2024 at 10:06 PM
To: Benjamin Leis <benjamin.leis <at> servicenow.com>
Cc: 70614 <at> debbugs.gnu.org <70614 <at> debbugs.gnu.org>, Theodor Thornhill <theo <at> thornhill.no>
Subject: Re: bug#70614: Wrong simple imenu definition for java
[External Email]



> 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 <at> 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/<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
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Tue, 30 Apr 2024 18:28:02 GMT) Full text and rfc822 format available.

Message #14 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 70614 <at> debbugs.gnu.org, Benjamin Leis <benjamin.leis <at> servicenow.com>
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Tue, 30 Apr 2024 20:27:23 +0200
Yuan Fu <casouri <at> gmail.com> writes:

>> 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 <at> 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?

I like it - let's get it in :)

Theo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Tue, 30 Apr 2024 18:31:02 GMT) Full text and rfc822 format available.

Message #17 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Benjamin Leis <benjamin.leis <at> servicenow.com>
Cc: Yuan Fu <casouri <at> gmail.com>,
 "70614 <at> debbugs.gnu.org" <70614 <at> debbugs.gnu.org>
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Tue, 30 Apr 2024 20:30:11 +0200
Benjamin Leis <benjamin.leis <at> servicenow.com> writes:

> Hi Yuan
>
> Yes it was me that posted on reddit. I’ll look into the sparse tree
> method – that looks promising.  I’d be happy to add into the tree.
> What would the process be for that?
>
> Ben

If you just extend the current implementation and wrap it nicely in a
patch and send it as a reply to this email, I'd be happy to review and
merge. Remember that for some "significant" contribution an assignment
to the FSF is needed. You can ask for a form to start that process here,
and someone will send it to you off list.

That can take some time, so if you're willing to do that I'd suggest you
get started on that sooner rather than later :-)

Theo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Wed, 01 May 2024 01:12:01 GMT) Full text and rfc822 format available.

Message #20 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "70614 <at> debbugs.gnu.org" <70614 <at> debbugs.gnu.org>,
 Benjamin Leis <benjamin.leis <at> servicenow.com>
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Tue, 30 Apr 2024 18:10:44 -0700

> On Apr 30, 2024, at 11:30 AM, Theodor Thornhill <theo <at> thornhill.no> wrote:
> 
> Benjamin Leis <benjamin.leis <at> servicenow.com> writes:
> 
>> Hi Yuan
>> 
>> Yes it was me that posted on reddit. I’ll look into the sparse tree
>> method – that looks promising.  I’d be happy to add into the tree.
>> What would the process be for that?
>> 
>> Ben
> 
> If you just extend the current implementation and wrap it nicely in a
> patch and send it as a reply to this email, I'd be happy to review and
> merge. Remember that for some "significant" contribution an assignment
> to the FSF is needed. You can ask for a form to start that process here,
> and someone will send it to you off list.
> 
> That can take some time, so if you're willing to do that I'd suggest you
> get started on that sooner rather than later :-)
> 
> Theo

Eli, could you send Ben the copyright assignment form?

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Wed, 01 May 2024 06:53:02 GMT) Full text and rfc822 format available.

Message #23 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Benjamin Leis <benjamin.leis <at> servicenow.com>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: Yuan Fu <casouri <at> gmail.com>,
 "70614 <at> debbugs.gnu.org" <70614 <at> debbugs.gnu.org>
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Tue, 30 Apr 2024 20:55:15 +0000
[Message part 1 (text/plain, inline)]
I don’t know if our legal department will clear this or not but I’m reaching out to them. I can prepare a patch for the basic changes in the meantime.  You can see the basic code changes from that reddit post. I’ll rename the functions to match in java-ts-mode.el , look into the sparse tree function and if there is anything else stylistically, you’d like I could do that as well.

Smaller point, ,y preference is to expose records rather than enums and/or make the set configurable in a list.
Ben

From: Theodor Thornhill <theo <at> thornhill.no>
Date: Tuesday, April 30, 2024 at 11:30 AM
To: Benjamin Leis <benjamin.leis <at> servicenow.com>
Cc: Yuan Fu <casouri <at> gmail.com>, 70614 <at> debbugs.gnu.org <70614 <at> debbugs.gnu.org>
Subject: Re: bug#70614: Wrong simple imenu definition for java
[External Email]

Benjamin Leis <benjamin.leis <at> servicenow.com> writes:

> Hi Yuan
>
> Yes it was me that posted on reddit. I’ll look into the sparse tree
> method – that looks promising.  I’d be happy to add into the tree.
> What would the process be for that?
>
> Ben

If you just extend the current implementation and wrap it nicely in a
patch and send it as a reply to this email, I'd be happy to review and
merge. Remember that for some "significant" contribution an assignment
to the FSF is needed. You can ask for a form to start that process here,
and someone will send it to you off list.

That can take some time, so if you're willing to do that I'd suggest you
get started on that sooner rather than later :-)

Theo
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Wed, 01 May 2024 12:02:01 GMT) Full text and rfc822 format available.

Message #26 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: theo <at> thornhill.no, 70614 <at> debbugs.gnu.org, benjamin.leis <at> servicenow.com
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Wed, 01 May 2024 15:00:55 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Tue, 30 Apr 2024 18:10:44 -0700
> Cc: Benjamin Leis <benjamin.leis <at> servicenow.com>,
>  "70614 <at> debbugs.gnu.org" <70614 <at> debbugs.gnu.org>,
>  Eli Zaretskii <eliz <at> gnu.org>
> 
> Eli, could you send Ben the copyright assignment form?

Form sent off-list.




Added tag(s) pending. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 01 Mar 2025 02:42:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70614; Package emacs. (Tue, 04 Mar 2025 10:20:01 GMT) Full text and rfc822 format available.

Message #31 received at 70614 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Benjamin Leis <benjamin.leis <at> servicenow.com>
Cc: Yuan Fu <casouri <at> gmail.com>, Theodor Thornhill <theo <at> thornhill.no>,
 "70614 <at> debbugs.gnu.org" <70614 <at> debbugs.gnu.org>
Subject: Re: bug#70614: Wrong simple imenu definition for java
Date: Tue, 4 Mar 2025 02:19:42 -0800
Benjamin Leis <benjamin.leis <at> servicenow.com> writes:

> I don’t know if our legal department will clear this or not but I’m reaching out to them. I
> can prepare a patch for the basic changes in the meantime.  You can see the basic code
> changes from that reddit post. I’ll rename the functions to match in java-ts-mode.el , look
> into the sparse tree function and if there is anything else stylistically, you’d like I could do
> that as well.

Did you make any progress here?




This bug report was last modified 198 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.