on master help sign in
Only reconfiure highlights when setting theme
commit6825e195099de6e4eab64e26a230cf8a9c9521b7 authorwojciechkepka <wojtek.kepka@protonmail.com> dateSat 19 Jun 2021, 13:52 (5 years ago) parent42e13bd
2 files changed+10−11
helix-core/src/syntax.rs+9−10 helix-view/src/editor.rs+1−1
helix-core/src/syntax.rs+9−10
@@ -172,19 +172,18 @@ impl LanguageConfiguration {
172172 }
173173 }
174174
175− pub fn highlight_config(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> {
176− if let Some(config) = self.highlight_config.get() {
177− if let Some(config) = config {
178− config.configure(scopes);
179− }
180− config.clone()
181− } else {
182− self.highlight_config
183− .get_or_init(|| self.initialize_highlight(scopes))
184− .clone()
175+ pub fn reconfigure(&self, scopes: &[String]) {
176+ if let Some(Some(config)) = self.highlight_config.get() {
177+ config.configure(scopes);
185178 }
186179 }
187180
181+ pub fn highlight_config(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> {
182+ self.highlight_config
183+ .get_or_init(|| self.initialize_highlight(scopes))
184+ .clone()
185+ }
186+
188187 pub fn is_highlight_initialized(&self) -> bool {
189188 self.highlight_config.get().is_some()
190189 }
helix-view/src/editor.rs+1−1
@@ -85,7 +85,7 @@ impl Editor {
8585 .language_configs_iter()
8686 .filter(|cfg| cfg.is_highlight_initialized())
8787 {
88− config.highlight_config(scopes);
88+ config.reconfigure(scopes);
8989 }
9090
9191 self.theme = theme;