fix(cli): improve error message in cases where a langauge can't be found for one of many paths#4643
Merged
clason merged 1 commit intotree-sitter:masterfrom Aug 2, 2025
Merged
Conversation
for one of many paths
clason
approved these changes
Aug 2, 2025
|
Successfully created backport PR for |
github-actions bot
pushed a commit
that referenced
this pull request
Aug 2, 2025
…4643) Problem: When multiple input paths are provided to the `parse` command (a la `tree-sitter parse --paths [...]`), if a language can't be found for one of the paths, it can be a little unclear *which* path caused the failure. The loader *can* fail with `Failed to load language for file name <foo.bar>`, but this isn't guaranteed. Solution: Attach some additional context in the case where multiple paths can be provided, displaying the problematic path on failure. (cherry picked from commit 9ced617)
clason
pushed a commit
that referenced
this pull request
Aug 2, 2025
…4643) Problem: When multiple input paths are provided to the `parse` command (a la `tree-sitter parse --paths [...]`), if a language can't be found for one of the paths, it can be a little unclear *which* path caused the failure. The loader *can* fail with `Failed to load language for file name <foo.bar>`, but this isn't guaranteed. Solution: Attach some additional context in the case where multiple paths can be provided, displaying the problematic path on failure. (cherry picked from commit 9ced617)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Problem:
When multiple input paths are provided to the
parsecommand (a latree-sitter parse --paths [...]), if a language can't be found for one of the paths, it can be a little unclear which path caused the failure. The loader can fail withFailed to load language for file name <foo.bar>, but this isn't guaranteed.The Solution:
Attach some additional context in the case where multiple paths can be provided, displaying the problematic path on failure.
Before:
After:
This use case was brought up by digitcrusher in the community chat.