universal-ctags / citre

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

A new tool to investigate a tags file #172

Open AmaiKinono opened 5 months ago

AmaiKinono commented 5 months ago

Discussed in https://github.com/universal-ctags/citre/discussions/47

Originally posted by **AmaiKinono** January 23, 2021 When solving #46, I found that "xref prompts you for an identifier" is a basic tool for investigating a tags file (hence investigating the project that's tagged). I want a more powerful tool for that. Here's what's in my mind now. After picking a tags file, it prompts you for input. You type: ``` psd input:scipy#kind:function kind:method ``` then, it asks readtags to search for tags that has `psd` in the name, and `scipy` in the input field. Then, further filtering is done on the elisp side, to pick tags whose kind is `function` or `method`. The input scheme can be designed to be simpler, but the point is *two-stage filtering*. Before the `#`, the filter is done by readtags (asynchronously); after the `#`, it's done by elisp. This 2nd stage part may also be brought to `citre-peek` to further narrow down the results. The tags that are filtered out are updated as you input. At any time, you can copy the name of a tag (to paste in your code), jump to its location, or convert those tags into a peek or xref session. [consult](https://github.com/minad/consult) and [embark](https://github.com/oantolin/embark) are the packages to study. Consult is based on a completing-read wrapper, and has a similar UI for grep (it's asynchronous!). Embark support multiple actions in a completing-read session. Emacs doesn't come with similar functionalities, and it's not easy to implement. So at the end I may develop a separate package based on them and Citre.