on master help sign in
tree-sitter: Prevent panic on loading queries
fa1dc7eMichael Davis
helix-core/src/syntax.rs+2−1
@@ -374,7 +374,8 @@ impl LanguageConfiguration {
374 &injections_query,
374 &injections_query,
375 &locals_query,
375 &locals_query,
376 )
376 )
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()?;
378
379
379 config.configure(scopes);
380 config.configure(scopes);
380 Some(Arc::new(config))
381 Some(Arc::new(config))