New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Machine-readable output of parser generation errors #3182
Labels
Milestone
Comments
That seems like a good feature to add! |
Machine-readable output of parsing results would also be nice to have. {
"results": [
{
"file": "foo",
"result": "SUCCESS|ERROR|MISSING|UNEXPECTED",
"start": [0, 0],
"end": [1, 1],
"time": 0.1, // ms
"bytes": 1000 // bytes/ms
},
...
],
"total": 1,
"successful": 1,
"failed": 0,
"speed": 1000 // bytes/ms
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Tree-sitter is doing a great job then reporting problems with the grammar (I'm currently mostly interested in conflicts), I really like the presentation and having possible resolutions, thanks!
But for the problem I'm trying to solve currently, it would be super handy to be able to get this information in machine-readable format (I was thinking about JSON, but doesn't really matter much). Of course, I can parse the current tree-sitter output to extract the needed information, but that seems a bit backwards: why would I parse strings that were pretty printed for me just moments ago?
So, I was thinking about adding something like
--json-errors
flag to thegenerate
command. I could, of course, just do it in my fork, but I was wondering if that's something that could be also accepted upstream.Expected behavior
tree-sitter generate --json-errors
reports conflicts (and potentially other problems with the grammar) in JSON format, something like:The text was updated successfully, but these errors were encountered: