From 3445abf88e550cce8ff5683f6fe45d7310597fd7 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sat, 13 Mar 2021 11:06:02 +0900 Subject: syntax: Hide the TSParser internally, borrowing when needed. --- helix-term/src/ui/editor.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index a9aa6fec..68f25830 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -92,18 +92,10 @@ impl EditorView { // TODO: only recalculate when state.doc is actually modified let highlights: Vec<_> = match &view.doc.syntax { Some(syntax) => { - syntax::PARSER.with(|ts_parser| { - syntax - .highlight_iter( - &mut ts_parser.borrow_mut(), - source_code.as_bytes(), - Some(range), - None, - |_| None, - ) - .unwrap() - .collect() // TODO: we collect here to avoid holding the lock, fix later - }) + syntax + .highlight_iter(source_code.as_bytes(), Some(range), None, |_| None) + .unwrap() + .collect() // TODO: we collect here to avoid holding the lock, fix later } None => vec![Ok(HighlightEvent::Source { start: range.start, -- cgit v1.2.3-70-g09d2