tree-sitter / tree-sitter

An incremental parsing system for programming tools

Home Page:https://tree-sitter.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse always add time info if grammar error

LuisMorenoSerrano opened this issue · comments

Problem

tree-sitter parse and a file with a grammar error always adds a line at the end that shows the same information as if the --time flag had been activated.

This behavior is caused by:

tree-sitter/cli/src/parse.rs

...
if first_error.is_some() || opts.print_time {
...

Why show execution time when an error occurs, even if the corresponding flag --time has not been specified?

Expected behavior

I think it is not a good idea to mix both situations in the same piece of code, or at least redirect this kind of error info via stderr instead of stdout.