Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the library ripgrep instead of relying on the executable rg #875

Closed
liuchengxu opened this issue Sep 20, 2022 · 1 comment · Fixed by #872
Closed

Use the library ripgrep instead of relying on the executable rg #875

liuchengxu opened this issue Sep 20, 2022 · 1 comment · Fixed by #872

Comments

@liuchengxu
Copy link
Owner

liuchengxu commented Sep 20, 2022

ripgrep provides a library https://github.com/BurntSushi/ripgrep/blob/master/crates/grep/README.md which can be easily integrated into our Rust backend. The story is that while working on #872, I found that collecting the source items by invoking the shell command rg is somewhat annoying as the shell command does not produce items linearly, the output is empty from some point and then spikes suddenly, leading to a bad user experience. Responsiveness is really important. Maybe I did something wrong to collect the source item from the shell command, but with a quick experiment, I found using the crate grep helps resolve it and it'd also remove one explicit external binary dependency, hence I think it's a good addition.

Other potential benefits:

  • Once the new search syntax is supported, e.g., use +git to include only the results from git tracked files, using the library ripgrep may help skip the unrelated files at the stage of walking the directory.
@liuchengxu
Copy link
Owner Author

This will be addressed in #872, the prototype implementation shows a pretty good result, now the grep is super fast/responsive without using any caching strategy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant