aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-13 02:06:02 +0000
committerBlaž Hrastnik2021-03-13 02:06:02 +0000
commit3445abf88e550cce8ff5683f6fe45d7310597fd7 (patch)
tree36187a11a149fdb17334cb17873d3d7533c74aff /helix-term
parent6cbfb050e2c99acf5cdfe7d981c262fbdeaf761c (diff)
syntax: Hide the TSParser internally, borrowing when needed.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/editor.rs16
1 files changed, 4 insertions, 12 deletions
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,