From 24314bd844d1900252f108968b39dfa4c800ca92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 10 Jan 2022 00:40:02 +0900 Subject: [PATCH] Only call scopes.load() once --- helix-core/src/syntax.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index b0c5e43a2..7359416dd 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -462,12 +462,11 @@ impl Syntax { let mut queue = VecDeque::new(); queue.push_back(self.root); + let scopes = self.loader.scopes.load(); let injection_callback = |language: &str| { self.loader .language_configuration_for_injection_string(language) - .and_then(|language_config| { - language_config.highlight_config(&self.loader.scopes.load()) - }) + .and_then(|language_config| language_config.highlight_config(&scopes)) }; // Convert the changeset into tree sitter edits.