tree-sitter icon indicating copy to clipboard operation
tree-sitter copied to clipboard

Return early if syntax errors are encountered

Open criminosis opened this issue 1 year ago • 2 comments

Hi Tree-Sitter team!

In my use case of Tree-Sitter I've been parsing source code samples but was wanting to early exit if the file had an error during the parsing. I followed in the footsteps of the other parser settings (exit flag and timeout) for the rust binding.

Full disclosure I'm not completely sure if I got all the web asm binding side of things, I'm primarily coming in through the Rust binding side. But I tried to mimic everywhere I saw the timeout exit being exposed.

Happy to make changes!

criminosis avatar May 25 '23 02:05 criminosis

@criminosis Thank you for the PR and the idea, but I added a proposal #2541 with a more generic design.

ahlinc avatar Aug 20 '23 15:08 ahlinc

@ahlinc Glad to hear someone else liked the idea, I was beginning to worry I had fundamentally misunderstood my approach in my PR 😅 .

Checked out your proposal, it makes a lot of sense. Hope it gets some momentum!

criminosis avatar Aug 20 '23 16:08 criminosis