-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add init support for a user defined PATH/glob cmd #113
base: master
Are you sure you want to change the base?
Conversation
Can be user defined as the new global `g:any_jump_glob_scanner` and its value is only conditionally used inside `RunRgDefinitionSearch()` (for now, not sure if in side `RunRgUsagesSearch()` is also useful/warranted?) Notes: - only implemented thus far for `rg` backend - not sure if it's "smarter" to avoid use of `rg -u` filter removal and instead use `-g <PATH>` or some other `.gitignore` override thingy?
let cmd = cmd . s:GetRgIgnoreSpecifier() | ||
let cmd = cmd . ' ' . a:patterns | ||
|
||
" NOTE: the `-e` is ok here to be explicit right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured it was better then being implicit?
autoload/search.vim
Outdated
let scan_cmd = g:any_jump_glob_scanner | ||
if strlen(scan_cmd) | ||
let scan_results = system(scan_cmd) | ||
" echo 'Additional ' a:language . ' PATHs to scan: ' . scan_results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was just left in for debugging, obviously can be removed.
autoload/search.vim
Outdated
let cmd = cmd . ' ' . scan_results | ||
endif | ||
|
||
" TODO: is it more correct to pass `-g <glob>` flags here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like feedback on whether this (or something else) is a better approach?
Also see the TODOs in the description.
@@ -137,6 +137,10 @@ call s:set_plugin_global_option('any_jump_disable_vcs_ignore', v:false) | |||
" default is: ['*.tmp', '*.temp'] | |||
call s:set_plugin_global_option('any_jump_ignored_files', ['*.tmp', '*.temp']) | |||
|
|||
" Custom glob scanning command used to dynamically | |||
" produce PATHs fed into `rg`/`ag` | |||
call s:set_plugin_global_option('any_jump_glob_scanner', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sold on this name yet either 😂
suggestions welcome!
An attempt to resolve #112.
I'm not sure if this kinda thing will make all that much sense for AOT compiled langs (since often getting lib symbols isn't so straight forward as running some command to produce source-code-file-containing directories) but, it definitely is a thing in a language like
python
which users often dev / deploy in "isolated" runtime environments ("virtual envs"). In this case I have defined my custom glob scanner as:which allows searching symbol defs in the user's locally activated python runtime env and thus the env specific
../site-packages/*
.Also included are some slight formatting tweaks in a couple of spots that seemed to have extra whitespace and a couple tweaks to the
rg -g '!<globpatt>'
quoting to work better when echoing the full cmd from vim for manuall copy/pasta debugging.Still TODO
g:any_jump_glob_scanner
and its value is only conditionally used insideRunRgDefinitionSearch()
(for now, not sure if in sideRunRgUsagesSearch()
is also useful/warranted?)-[ ] currently only implemented thus far for
rg
backendrg -u
filter removal and instead use-g <PATH>
or some other >.gitignore
override thingy?ag
support!rg