jacktasia / dumb-jump

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

`git grep` is preferred over `rg` but is massively deficient #448

Open zenspider opened 7 months ago

zenspider commented 7 months ago

Without any config, if any project I use that is backed by git, then dumb-jump prefers to use git grep to find definitions via dumb-jump-pick-grep-variant. The problem, in C or ruby or anything else I've tried, is that it doesn't find ANYTHING... 0% hit rate. If I set '(dumb-jump-force-searcher 'rg) then everything works well. I don't know if git grep regexps are deficient or broken because I find dumb-jump hard to navigate but the problem certainly lies with the searcher. For some reason I can't figure out, it chooses git-grep over dumb-jump-prefer-searcher, so I'm not sure what the prefer vs force distinction is for.

I would also suggest that rg be preferred over ag.

gmichokostas commented 7 months ago

I've got the same issue as well. If I add (setq dumb-jump-force-searcher 'rg) in my config everything works.

mrunhap commented 6 months ago

Same here, it just don't work at all unless set force searcher, tested on python and golang.

dpassen commented 6 months ago

Duplicate of #428

zenspider commented 6 months ago

I don't consider this a duplicate. Part of the problem, not addressed in the other issue, is ignoring my preference and choosing git grep over my settings.

zenspider commented 6 months ago

Since this project doesn't seem to be maintained these days, I'm experimenting with a fork I'm making called dumber-jump. Only uses rg and completing-read and removes the long obsoleted functions. Much less to configure.

jacktasia commented 6 months ago

I've got the same issue as well. If I add (setq dumb-jump-force-searcher 'rg) in my config everything works.

This is the solution if git grep doesn’t work for you. I am really confused why this one line of config is such a big deal.

The reason preferred (more like fallback) doesn’t work is because git grep is actually available and at some point git grep was considered the optimal searcher, but unfortunately git has borked its grep implementation in recent versions. It’s complicated by the fact that there are/were a very wide assortment of git versions in the wild, so I am hesitant to change that default.

This should actually default to just grep since that’s widely installed in a “just works” sense.

No great solution in my mind. If someone wants to make a fork then that’s certainly fine with me.

pierre-rouleau commented 5 months ago

@zenspider , I must admit I don't understand the problem either. The code has the dumb-jump-force-searcher user-option. It can be customized and takes over. What does "it ignores my preference" mean?

zenspider commented 5 months ago

There's a 2 year old bug open on this project explaining how git grep hasn't worked for some time... so I don't feel terribly motivated to explain how the preferences are broken.

The short version:

"The preferred searcher to use 'ag, 'rg, 'git-grep, 'gnu-grep,or 'grep.
If nil then the most optimal searcher will be chosen at runtime."

there shouldn't be 2 settings for what searcher you prefer. nil says "Best Available", and everything else should be respected. Period. To have a second variable that means "no really, I want this one"? Bad design. Don't get me started.

Nevermind the fact that git grep isn't the best and has consistently been the worst for multiple years now AND has been on your radar as broken this whole time.

from the readme:

This means minimal -- and ideally zero -- configuration

So much for that.


Since it seems obvious to me that the maintainer has no intention of addressing these deficiencies, I'm going to focus on cleaning up my fork and getting it published. @jacktasia feel free to close this issue as you see fit.

zenspider commented 4 days ago

Took me long enough, but I have published zenspider/dumber-jump, now on melpa. It has sensible defaults that have allowed me to get rid of all my dumb-jump customization that I needed to work.