helixbass / tree-sitter-grep

The Unlicense
10 stars 1 forks source link

Auto-language detection #24

Closed helixbass closed 1 year ago

helixbass commented 1 year ago

In this PR:

To test: Existing behavior should continue to work If you try omitting the --language command-line option in a project with only a single supported file-type (eg a Rust project) then you should see the same matches as with --language rust. And hopefully performance (of a release build) is relatively comparable (it looked a bit slower when running against the Typescript compiler in Rust codebase but when running against a smaller Typescript codebase it seemed indistinguishable, I'm not going to worry about it too much for now) If you try running in a directory with multiple types of supported files (Rust/Typescript/JS) (eg the newly added tests/fixtures/mixed_project/ directory) with a query that should only be parseable by one of those language's tree-sitter grammars then you should see the expected results for those files but not see any errors related to trying to parse for the other encountered supported file types If you try running in a directory with multiple types of supported files with a query that should be parseable by more than one of those language's tree-sitter grammars (eg (arrow_function) @a for Typescript/JS) then you should see the expected results for files of all of those file types

Closes #22

Based on specify-files