Closed CharlemagneLasse closed 4 months ago
Hi @CharlemagneLasse, I'd love someone to improve this but for now I've done my best with this situation. Traditional grep
output is not unambiguously parseable: it uses characters as separators that may appear in file names. In my defense,
See the ~500 lines of unit tests here: https://github.com/dandavison/delta/blob/main/src/handlers/grep.rs#L653-L1177. If you can improve the parsing while keeping all those tests passing (and hopefully adding a test for what you're fixing) that would be fantastic.
This is documented in the manual: https://dandavison.github.io/delta/grep.html
If you don't need special features of git grep, then for best results pipe rg --json output to delta: this avoids parsing ambiguities that are inevitable with the output of git grep and grep.
Personally, I have gone all-in on ripgrep, using rg --json | delta
in all my rip grep aliases / shell commands / fzf utilities etc. But I do understand that git grep
can do things that rg
cannot.
If you don't mind I'm going to close this, since I'm not personally planning more development on it (but would welcome contributions) and it's a dup of #1083 and #1259. But as always please don't interpret a closed issue as discouragement to keep discussing.
I wanted to use delta to filter my grep output and then ctrl+click on the filename + line numbers. But I've noticed that the filenames were not displayed correctly and thus the "Open File from Terminal" functionality from KDE konsole was not working.
Simple test case in the OpenWrt repository at commit 3a073a021286bef3fed0ca7884872c5890420d60:
The git-grep raw output is:
But delta 1.16.5 (linux amd64) is creating following output (just by running
git grep -n PKG_CONFIG -- package/network/config/
):The error is in the second line because it replaced
ltq-
withltq:
.My complete
.gitconfig
during this test is:But it is also reproducible when using (to work around the tab bug):