vrothberg/vgrep

Seems like -A, -B and -C is broken in the latest release

marcosnils opened this issue · 15 comments

Seems like #84 stopped working on the latest release. I'm getting stack traces errors or "failed to parse results" whenever I try to use one of those options.

Sorry for not getting back to you!

That was huge lack of coffee on my side as I closed #88 instead of merging. The -A parsing was later tackled by @Qeole where we decided to error out.

I am still open to ignore non-matching lines (as long as we log them). @Qeole @marcosnils what do you think?

I am still open to ignore non-matching lines (as long as we log them).

Hmmm.. I can't recall how this worked and I can't test it again since the branch has been removed. Do you mind sending the PR again and rebasing so I can try it out @vrothberg ?

I am still open to ignore non-matching lines (as long as we log them).

Hmmm.. I can't recall how this worked and I can't test it again since the branch has been removed. Do you mind sending the PR again and rebasing so I can try it out @vrothberg ?

Sure! Here's a PR to test: #119

My work flow for displaying context lines is:

$ vgrep ...
$ vgrep -sc N

Would that work for you?

Ping @marcosnils. What do you think?

Just tried this... I'm not convinced about the UX though..

I'm still not sure why we can't do something like vgrep -C 10 <search> and output all the possible lines that you can jump to in vgrep's output as well.

I'm still not sure why we can't do something like vgrep -C 10 <search> and output all the possible lines that you can jump to in vgrep's output as well.

#119 should do that. It's ignoring the separation lines though. Can you give an example how you would like it to look like?

#119 should do that. It's ignoring the separation lines though. Can you give an example how you would like it to look like?

You're right.. seems like I was using the wrong version. I just have it another shot and I got this result

image

^ As you can see the output from standard grep and vgrep is a bit different, specially since it's missing some results that I get with grep. Is that expected?

Curious. I can't reproduce on Fedora. Are you on Mac OS?

I'm using Linux with ripgrep backend.

Here's the debug output to see if that helps to see what could be happening. I can see some "failed to parse" which I think is the issue, correct?

image

Sorry for the longer silence! Busy times after a relocation.

I need some more time to think this through but I am always open to suggestions. It's a hairy issue and I don't want to break backwards compat.

On a positive note: there is a workaround by first doing vgrep foo follow by vgrep -sc (for showing context lines).

@marcosnils could you have another at #119? It turned out that git grep and grep/ripgrep behave again slightly different which was causing the issue you saw with ripgrep.

If you're cool with the changes, I can wrap things up and cut a new release soon.

Sure, will check in a few mins

Works like charm @vrothberg 💪 LGTM! Preciate taking the time to check this

Works like charm @vrothberg muscle LGTM! Preciate taking the time to check this

Thanks for testing and your patience!