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

interactive projectile-grep like counsel-projectile-grep #281

Closed
aspiers opened this issue Dec 16, 2020 · 7 comments
Closed

interactive projectile-grep like counsel-projectile-grep #281

aspiers opened this issue Dec 16, 2020 · 7 comments

Comments

@aspiers
Copy link

aspiers commented Dec 16, 2020

After reading #112 and #233, I have stopped using counsel-projectile and now have most projectile commands working nicely with selectrum. However I notice that projectile-grep does not dynamically update a list of candidates as more characters are entered, in the same way that counsel-projectile-grep did. Is there any way to achieve this?

@clemera
Copy link
Collaborator

clemera commented Dec 17, 2020

This is discussed more generally in #114. You can achieve that currently with Selectrum by passing a dynamic candidate function to selectrum-read (we have examples of that in the wiki) but it's not clear if something like this could work nicely with default completion and dynamic completion tables. I think a good compromise would be to ask for the search term first and then give you a list back which you can use continuous completion on. I think @minad is also looking for approaches to implement such a command in consult.

@aspiers
Copy link
Author

aspiers commented Dec 17, 2020

Thanks! I had missed #114 - I'll keep an eye on it and also check out the wiki!

@minad
Copy link
Contributor

minad commented Jan 2, 2021

Can be closed? We have consult-grep, consult-ripgrep and consult-git-grep with project support now.

@aspiers
Copy link
Author

aspiers commented Jan 2, 2021

Oh cool! I'll check them out.

@aspiers aspiers closed this as completed Jan 2, 2021
@aspiers
Copy link
Author

aspiers commented Jan 2, 2021

I've had a look at these 3 functions and they are almost perfect, but they are lacking the final piece in terms of integration with projectile-grep. Compare with counsel-projectile-grep, whose docstring says:

If inside a git project and ‘projectile-use-git-grep’ is non-nil, use git grep. Otherwise use grep recursively.

Although that doesn't explicitly say it, the key difference is that if you are visiting a file in a subdirectory of the git repo and you invoke counsel-projectile-grep, it will search the whole repo, not just the current subdirectory like the three consult grep functions mentioned above.

So ideally there would be an analogous consult-projectile-grep which when invoked from within a git repo, first changes directory to the repo root directory then uses consult-git-grep or consult-ripgrep to do the searching, and when invoked from outside a git directory, uses either consult-grep or consult-ripgrep as normal.

@aspiers aspiers reopened this Jan 2, 2021
@minad
Copy link
Contributor

minad commented Jan 2, 2021

@aspiers No, actually they are perfect ;)

I wrote above: with project support - they can be configured such that they behave like you described. But I must admit, the readme didn't mention project support before. I updated the readme. Please take a look.

@aspiers
Copy link
Author

aspiers commented Jan 2, 2021

OK great, thanks. I had noticed the mention of project support and as a result even read the source for the three functions but had missed that the support is "hidden" in consult--directory-prompt. I now have it working. In the process I noticed a couple of minor issues but I'll file them on the consult repo to avoid spamming selectrum further. Thanks a lot!

@aspiers aspiers closed this as completed Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants