-
-
Notifications
You must be signed in to change notification settings - Fork 792
fix(cli): prevent panic when searching across different file types #6192
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
fix(cli): prevent panic when searching across different file types #6192
Conversation
siketyan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
| // Default to JavaScript when no language is specified | ||
| &GritTargetLanguage::JsTargetLanguage(JsTargetLanguage) | ||
| } | ||
| _ => return Ok(FileStatus::Ignored), // unreachable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _ => return Ok(FileStatus::Ignored), // unreachable | |
| _ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep it as is, as otherwise we'd panic again if it turns out we made a mistake (either now or after a refactor).
arendjr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| // Default to JavaScript when no language is specified | ||
| &GritTargetLanguage::JsTargetLanguage(JsTargetLanguage) | ||
| } | ||
| _ => return Ok(FileStatus::Ignored), // unreachable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep it as is, as otherwise we'd panic again if it turns out we made a mistake (either now or after a refactor).
Co-authored-by: Naoki Ikeguchi <[email protected]>
Summary
Closes #5979
This PR updates the
biome searchcommand to check the file type and pattern language before performing a search.By default, biome search assumes JavaScript, but it would previously panic if a CSS file was included in the search targets.
With this change, the command no longer panics.
Test Plan
I also tested on the repro: https://github.com/Sjlver/biome-repro-1747046861198