on master help sign in
Only reconfiure highlights when setting theme
6825e19wojciechkepka
helix-core/src/syntax.rs+9−10
@@ -172,19 +172,18 @@ impl LanguageConfiguration {
172 }
172 }
173 }
173 }
174
174
175− pub fn highlight_config(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> {
175+ pub fn reconfigure(&self, scopes: &[String]) {
176− if let Some(config) = self.highlight_config.get() {
176+ if let Some(Some(config)) = self.highlight_config.get() {
177− if let Some(config) = config {
178− config.configure(scopes);
177+ config.configure(scopes);
179− }
180− config.clone()
181− } else {
182− self.highlight_config
183− .get_or_init(|| self.initialize_highlight(scopes))
184− .clone()
185 }
178 }
186 }
179 }
187
180
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+
188 pub fn is_highlight_initialized(&self) -> bool {
187 pub fn is_highlight_initialized(&self) -> bool {
189 self.highlight_config.get().is_some()
188 self.highlight_config.get().is_some()
190 }
189 }
helix-view/src/editor.rs+1−1
@@ -85,7 +85,7 @@ impl Editor {
85 .language_configs_iter()
85 .language_configs_iter()
86 .filter(|cfg| cfg.is_highlight_initialized())
86 .filter(|cfg| cfg.is_highlight_initialized())
87 {
87 {
88− config.highlight_config(scopes);
88+ config.reconfigure(scopes);
89 }
89 }
90
90
91 self.theme = theme;
91 self.theme = theme;