on master help sign in
syntax: highlight_iter always returns Ok()
commit081e0ae8ae4ead621010e7e6a060194fe2433bad authorBlaž Hrastnik <blaz@mxxn.io> dateTue 16 Mar 2021, 13:49 (6 years ago) parent71f899c
2 files changed+2−3
helix-core/src/syntax.rs+2−2 helix-term/src/ui/editor.rs−1
helix-core/src/syntax.rs+2−2
@@ -269,7 +269,7 @@ impl Syntax {
269269 range: Option<std::ops::Range<usize>>,
270270 cancellation_flag: Option<&'a AtomicUsize>,
271271 mut injection_callback: impl FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
272− ) -> Result<impl Iterator<Item = Result<HighlightEvent, Error>> + 'a, Error> {
272+ ) -> impl Iterator<Item = Result<HighlightEvent, Error>> + 'a {
273273 // The `captures` iterator borrows the `Tree` and the `QueryCursor`, which
274274 // prevents them from being moved. But both of these values are really just
275275 // pointers, so it's actually ok to move them.
@@ -325,7 +325,7 @@ impl Syntax {
325325 last_highlight_range: None,
326326 };
327327 result.sort_layers();
328− Ok(result)
328+ result
329329 }
330330 // on_tokenize
331331 // on_change_highlighting
helix-term/src/ui/editor.rs−1
@@ -94,7 +94,6 @@ impl EditorView {
9494 Some(syntax) => {
9595 syntax
9696 .highlight_iter(text.slice(..), Some(range), None, |_| None)
97− .unwrap()
9897 .collect() // TODO: we collect here to avoid holding the lock, fix later
9998 }
10099 None => vec![Ok(HighlightEvent::Source {