universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
320 stars 26 forks source link

imenu categories #140

Closed frithrah closed 3 months ago

frithrah commented 1 year ago

Thank you for this excellent package. I'm using it with GNU Global.

I'd like to ask if it's possible to select which tag categories go into the imenu list? I primarily use imenu to quickly jump around functions - I also use imenu-list for function overview.

Currently, citre divides the tags into categories such as function, parameter, local, etc. I'm really only interested in functions so I find all of the other entries distracting. Also, every time I execute imenu, I have to select the functions parent before I can see function names.

If this is not already possible then I envisage two helpful settings, 1. to flatten the imenu list so there are no nested entries and, 2. to specify which categories are used in imenu - e.g. citre-imenu-categories - a list of categories to put into the imenu list.

What do you think?

AmaiKinono commented 1 year ago

First I'd like to make sure you are actually using the global backend. Global backend can't classify tags as the kind information is not provided by global. You may be using the tags backend or imenu provided by the major mode, not Citre.

I do think the flatten behavior is useful. However, it shouldn't be done on the imenu backend side. The imenu UI should decide whether to flatten or keep only one category, this has the advantage that it works for all imenu backends, not just Citre.

imenu--make-index-alist returns the tree structure of imenu entries in a plain alist, and a user command could show them in any way. It seems there are already such plugins:

frithrah commented 1 year ago

Thank you for your suggestions - it's very kind of you. The imenu packages and that code sample look helpful.

And, you're right, I deleted my GTAGS files and the imenu categories remained so they must be generated by the major mode, c++-mode. Sorry for the confusion.