This PR adds text.find (alternately grep) commands. They can be used to search for text or numeric literals appearing anywhere in your project. Just supply one or more tokens to search for and it will do substring matching. Unlike regular grep over the text of your code, this will ignore local variables and function names that happen to match your search tokens (use dependents or find for that purpose). It's only searching among the text literals and numeric literals that appear in your functions. Here's the help:
So you can search either the current project, or you can include all of lib as well.
Added transcript to test and illustrate.
I didn't try to do regex matching, leaving that for future work or someone else should feel to take over this PR. I also didn't try to include a preview of each search result but that would be cool as well.
Thanks to @etorreborre for inspiring this. :)
Implementation notes
The implementation isn't using any sort of index; it has to load each term in memory and scan the ABT. This is very fast for most projects. For including search of lib too, it's actually still fast enough but you do notice a pause of a few seconds. It is scanning the definitions by hash, so it's only actually searching the total number of unique hashes that appear in lib.
This PR adds
text.find
(alternatelygrep
) commands. They can be used to search for text or numeric literals appearing anywhere in your project. Just supply one or more tokens to search for and it will do substring matching. Unlike regular grep over the text of your code, this will ignore local variables and function names that happen to match your search tokens (usedependents
orfind
for that purpose). It's only searching among the text literals and numeric literals that appear in your functions. Here's the help:So you can search either the current project, or you can include all of
lib
as well.Added transcript to test and illustrate.
I didn't try to do regex matching, leaving that for future work or someone else should feel to take over this PR. I also didn't try to include a preview of each search result but that would be cool as well.
Thanks to @etorreborre for inspiring this. :)
Implementation notes
The implementation isn't using any sort of index; it has to load each term in memory and scan the ABT. This is very fast for most projects. For including search of
lib
too, it's actually still fast enough but you do notice a pause of a few seconds. It is scanning the definitions by hash, so it's only actually searching the total number of unique hashes that appear inlib
.