Skip to content

fix(cli): increase verbosity of tree-sitter init -u updates#5178

Merged
WillLillis merged 2 commits intotree-sitter:masterfrom
WillLillis:init_updates
Dec 31, 2025
Merged

fix(cli): increase verbosity of tree-sitter init -u updates#5178
WillLillis merged 2 commits intotree-sitter:masterfrom
WillLillis:init_updates

Conversation

@WillLillis
Copy link
Member

Also, use info logs rather than warn

Opening this to start a discussion regarding what (and how much) information should be displayed for the tree-sitter init command. In this PR's current state, I've updated all log statements to use info rather than warn. As any updates made to a grammar's files through this command was explicitly requested via the -u flag, this seems more appropriate. I've also clarified "updating" in several logs where this could be confused with updating the dependencies in a lock file.

After some feedback/discussion here, I hope we can settle on a more uniform stream of logs for the actions taken for this command. A few questions to get started:

  • Should the command output a log when a file is generated for the first time?
  • Should specific information be displayed regarding what in a file is being updated (as I've done for a few logs here), or just that changes are being done?
  • Should a log be displayed if a particular language's bindings are disabled, stating that no generation/updates will be done?

@clason
Copy link
Contributor

clason commented Dec 27, 2025

My main concern is when things don't get updated, because that leads to discoverability issues, e.g., new fields in tree-sitter.json that aren't added, and people will have no idea that they even exist. (This is not academic: tree-sitter init will create all binding fields now, but init -u won't add them to an existing file.)

So in my opinion:

  • no need to output anything on init (the files on disk are "log" enough");
  • no real need to output successful changes on init -u (since it is reasonable to assume that people who want change tracking work in a git repository and can just do git status and git diff);
  • more concrete info (not warning) on what is changed in existing files is an improvement over the status quo.

@WillLillis
Copy link
Member Author

@clason The latest commit fills in the schema and any new bindings fields (i.e. if they're missing, they'll get an explicit false instead) to tree-sitter.json. I'll have some time to take a pass on your other bullet points hopefully soon!

@WillLillis
Copy link
Member Author

  • no real need to output successful changes on init -u (since it is reasonable to assume that people who want change tracking work in a git repository and can just do git status and git diff);
  • more concrete info (not warning) on what is changed in existing files is an improvement over the status quo.

Could you give an example to help me differentiate between these two points here?

@clason
Copy link
Contributor

clason commented Dec 30, 2025

Ah, sorry, they were not really different -- or rather, the third point was entirely separate: "all this being said, your changes are a strict improvement on the status quo so worth merging in any case" ("if you warn, warn better" ;))

@WillLillis WillLillis marked this pull request as ready for review December 31, 2025 06:43
@WillLillis WillLillis merged commit dd60d5c into tree-sitter:master Dec 31, 2025
23 checks passed
@WillLillis WillLillis deleted the init_updates branch December 31, 2025 19:08
@tree-sitter-ci-bot
Copy link

Successfully created backport PR for release-0.26:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants