Currently, we do not support Bazel (Starlark) files. Even though it is very similar to Python, there are some slight differences, which would make it not ideal to reuse the grammar for Python for Starlark files.
What is your solution?
Add the Starlark grammar to the analyzer itself, which is fetched from https://github.com/tree-sitter-grammars/tree-sitter-starlark. This grammar accounts for the minute differences between Starlark and Python, making it a good candidate to add in the analyzer. This will allow us (and customers down the line) to begin writing rules targeting Bazel/Isopod files
Alternatives considered
Not adding another grammar and reusing the Python grammar for Starlark
What the reviewer should know
A couple notes, since I tacked on a few code changes that are not directly needed for this PR, but are more plumbing/nice-to-haves and relate to it more or less.
Removed the CPP field in the TSProject struct, C++ scanners are deprecated and no grammars that are actively maintained use C++ anymore.
moved the extern declaration to the root of the file, it's okay to have it in the function but it's clearer in general when there's a lot of externally-linked functions to have them be declared at the top level, and it's right above the function anyway, so clarity only increases here imo that these are functions defined elsewhere (inside C source files that are compiled into the final object)
removed wrapping each tree_sitter_foo call with an unsafe block and just wrapping the whole match arm with unsafe
What problem are you trying to solve?
Currently, we do not support Bazel (Starlark) files. Even though it is very similar to Python, there are some slight differences, which would make it not ideal to reuse the grammar for Python for Starlark files.
What is your solution?
Add the Starlark grammar to the analyzer itself, which is fetched from https://github.com/tree-sitter-grammars/tree-sitter-starlark. This grammar accounts for the minute differences between Starlark and Python, making it a good candidate to add in the analyzer. This will allow us (and customers down the line) to begin writing rules targeting Bazel/Isopod files
Alternatives considered
Not adding another grammar and reusing the Python grammar for Starlark
What the reviewer should know
A couple notes, since I tacked on a few code changes that are not directly needed for this PR, but are more plumbing/nice-to-haves and relate to it more or less.
tree_sitter_foo
call with anunsafe
block and just wrapping the whole match arm withunsafe