||6 months ago|
|nix||8 months ago|
|scripts||9 months ago|
|src||6 months ago|
|vendor||6 months ago|
|.envrc||1 year ago|
|.gitignore||1 year ago|
|.gitmodules||6 months ago|
|Cargo.lock||6 months ago|
|Cargo.toml||6 months ago|
|LICENSE||6 months ago|
|README.md||6 months ago|
|build.rs||6 months ago|
|default.nix||11 months ago|
|shell.nix||11 months ago|
grep, but uses
tree-sitter to search for structure instead of strings.
This isn't available packaged anywhere. That's fine, use
nix-env -if https://git.bytes.zone/brian/tree-grepper/archive/main.tar.gz
Use it like
grep (or really, more like
$ tree-grepper '(import_clause (import) (upper_case_qid)@name)' src/Main.elm:3:1:Browser src/Main.elm:4:1:Browser.Navigation src/main.elm:5:1:Css ...
tree-grepper uses Tree-sitter's s-expressions to find matches.
The binary name might change in the future if we find a better/shorter name. Stay tuned.
Some Terrible Benchmarks
On the first possible working version of
|Command||Mean Time (Hyperfine)|
So this is on
rg's level of quickness (which makes sense, as this tool uses their tree walking/gitignoring library.)
This tool may get slower as we add features, or faster as I learn more about how to write good Rust.
- be able to do the thing in "Usage" above
- output JSON to make embedding in other tools nicer
- make capturing sub-matches easy (
@namein the s-expression syntax)
- make this tool work on a bunch of languages, not just Elm (which I'm starting with to scratch an itch.)
- get conditionals working (
#match?from the tree-sitter docs don't work yet)
- add tests
manpage, nice help output, etc
- produce a query from a language's syntax instead of having to write s-expressions directly
- real/reproducible benchmarks
See LICENSE in the source.