diff options
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/document.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 770341dc..eb376567 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -972,8 +972,7 @@ impl Document { ) { if let (Some(language_config), Some(loader)) = (language_config, loader) { if let Some(highlight_config) = language_config.highlight_config(&loader.scopes()) { - let syntax = Syntax::new(&self.text, highlight_config, loader); - self.syntax = Some(syntax); + self.syntax = Syntax::new(&self.text, highlight_config, loader); } self.language = Some(language_config); @@ -1113,9 +1112,11 @@ impl Document { // update tree-sitter syntax tree if let Some(syntax) = &mut self.syntax { // TODO: no unwrap - syntax - .update(&old_doc, &self.text, transaction.changes()) - .unwrap(); + let res = syntax.update(&old_doc, &self.text, transaction.changes()); + if res.is_err() { + log::error!("TS parser failed, disabeling TS for the current buffer: {res:?}"); + self.syntax = None; + } } let changes = transaction.changes(); |