Open jsongerber opened 3 months ago
rg
does not directly support this out-of-the-box. The way this would have to be done right now is via piping (cf. link below). This however adds too much complexity. Another way would be to write a parser that joins patterns. That's quite tedious though as well.
See: https://github.com/BurntSushi/ripgrep/issues/875#issuecomment-378089924
PR on latter approach welcome.
Thank you for your quick response. I understand that this is not trivial. I still want to give it a shot as this feature is important for me (it could take a few weeks since I don't have a lot of time).
If you think this is too complex and hard to maintain, please let me know and I'll do it quick and dirty in my config.
If you're interested in a PR I have a few questions so that the PR I propose respects your needs, wants, quality requirements, etc:
**/{%s}*/**/*{%s}*.{%s}
if all default prefixes are used at the same time, where each %s
could be search
or search1,search2,...
, is that right?--glob
and have this new behavior opt in with a new config option? If so, what would you want this new config option to be named?Thank you!
Edit: After digging into the code, I see that the glob patterns could be much more complex since prefixes can be overridden, and the provided pattern in telescope can also be a glob pattern in itself, so I will need to build a glob pattern parser as you mentioned and then merge those patterns. I don't know how it's feasible, but I will investigate and try if possible
Ex-post: I realize you've answered some questions yourself in the edit, but yes, that is the core problem.
the final pattern could look like this: */{%s}/*/{%s}*.{%s} if all default prefixes are used at the same time, where each %s could be search or search1,search2,..., is that right?
I remember trying this myself at some point for the reason but discarded it because there will be quite a few edge cases if we would like to do this in a general purpose (all sorts of patterns, etc.) setup. It's probably best to think of ways to isolate this use case (prefixes, simple flags, etc.).
behavior opt in with a new config option
My hunch is uninitiated rg
users would expect this behavior by default, coinciding with the typical actual intent of inserting multiple flags. From that end yes, I'd say this probably is a good default. At the same time, the solution will have to be sufficiently robust.
I don't have much experience with telescope or this plugin codebase, do you see any caveat or edge case that would make this feature more complex that I think?
Parsing and merging is not easy ;)
Any other requirements? Commits naming, PR style, code style?
There is a stylua toml in the project that the binary should pick up automatically. CI I recall complains if the PR is not correctly formatted.
Is your feature request related to a problem? Please describe. When using extension
#
and directory name>
prefixes on the same telescope prompt, I get result for matches on the extension OR directory, I would like to have matches for the extension AND directory, is it possible?Describe the solution you'd like Be able to use
test >lua #plugins
prompt and get results for lua files inside plugins directoryDescribe alternatives you've considered None
Additional context This is the current result, the result shown is a lua file but not in the plugins directory