jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.57k stars 150 forks source link

Browse or list all available tags? #412

Closed hiepph closed 2 years ago

hiepph commented 2 years ago

dumb-jump-go-prompt is useful but I have to type the exact name of the tag to be able to jump to it. Is there any function to list all available tags so I can bind completing-read to browse them?

I miss this feature from ctags since I can browse all available tags. Image in a situation where you're not in reach of any function and you want to jump to a random function but you're too bothered to type exactly the name of that function. Having an interactive selection (completing-read) would be helpful.

phikal commented 2 years ago

The issue here is that dumb-jump's approach works surprisingly well in one direction (transforming a symbol into a specific regular expression depending on the language and grepping the project for it), but in the reverse direction you would generate a lot of matches, that might include a lot of false-positives. I think I tested this once, but it might be worth looking at it again to evaluate if this is practical enough to implement something like what ctags does.

hiepph commented 2 years ago

Okay, I understand. How about narrowing down the search? For example, I type something like read_, then I got a list of results such as read_file, read_string, etc. and then I browse these results (i.e. by completing-read). From this way, I can get 2 benefits:

jacktasia commented 2 years ago

This isn’t a good problem for dumb-jump. The whole point is you’re jumping from usage to a definition. If you don’t already have the full thing under point you want to jump to then this isn’t the right tool for the job.

Sounds like you want something closer to https://github.com/bmag/imenu-list

phikal commented 2 years ago

Hiep Pham @.***> writes:

Okay, I understand. How about narrowing down the search? For example, I type something like read_, then I got a list of results such as read_file, read_string, etc. and then I browse these results (i.e. by completing-read). From this way, I can get 2 benefits:

  • "dumb-jump" doesn't have to look at all available tags but only tags that match the query pattern.
  • I don't have to type exactly the tag name. This would reduce my mental effort.

That would be something like what xref-apropos-regexp should provide, and what I would consider to be the best interface. The same thing could be extended to a completion table that completing-read could use, the issue there is that with a narrowing completion framework, you either wouldn't start with the "read_" but an empty string, or you would be re-invoking a possibly costly grep on every keypress.

-- Philip Kaludercic