tree-sitter: Prevent panic on loading queries
commitfa1dc7e5086e598eb04a34407d8c09e5605b3760
authorMichael Davis <mcarsondavis@gmail.com>
dateThu 25 Aug 2022, 13:10 (4 years ago)
parent4c789cf
helix-core/src/syntax.rs+2−1
@@ -374,7 +374,8 @@ impl LanguageConfiguration {
374374 &injections_query,
375375 &locals_query,
376376 )
377− .unwrap_or_else(|query_error| panic!("Could not parse queries for language {:?}. Are your grammars out of sync? Try running 'hx --grammar fetch' and 'hx --grammar build'. This query could not be parsed: {:?}", self.language_id, query_error));
377+ .map_err(|err| log::error!("Could not parse queries for language {:?}. Are your grammars out of sync? Try running 'hx --grammar fetch' and 'hx --grammar build'. This query could not be parsed: {:?}", self.language_id, err))
378+ .ok()?;
378379
379380 config.configure(scopes);
380381 Some(Arc::new(config))