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

Dynamically extend the grep-bin scan paths? #112

Open
goodboy opened this issue Nov 22, 2023 · 1 comment · May be fixed by #113
Open

Dynamically extend the grep-bin scan paths? #112

goodboy opened this issue Nov 22, 2023 · 1 comment · May be fixed by #113

Comments

@goodboy
Copy link

goodboy commented Nov 22, 2023

It'd sure be handy to allow augmenting the rg/ag search paths for a given code base so as to be able to lookup defs for tokens not defined in the current repo / local directory tree.


As an example, say you are working on a project in an interpreted language like Python which enables dynamic lookup of all library paths with something like:

python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))"

Then you could combine it with rg like so:

rg -u 'open_nursery' @$(python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))")

And this would for example search all linked dependency libs token sets as well.


Afaict there's no global (let alone lang context specific) override variable for this?

it'd be handy to have some way to be able to conditionally augment the search domain.
For example the ALE linter plugin offers overriding the exec and options when using ruff with something like

let g:ale_python_ruff_executable = 'ruff'
let g:ale_python_ruff_options = ''

Interested to see what others think (or if i somehow just missed this in the docs 😂 )

@goodboy goodboy linked a pull request Nov 23, 2023 that will close this issue
4 tasks
@goodboy
Copy link
Author

goodboy commented Nov 23, 2023

ended up going with a slightly different approach in #113 by letting the user just define a rg -e <lang-patt> PATH generator cmd to be able to dynamically generate the paths to scan. Not sure if long run this is the best solution but it definitely is flexible enough to cover the simple case of having local code that provides a symbol def set, and we want to just sick the grep backend to those files..

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

Successfully merging a pull request may close this issue.

1 participant