diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs index c4129d1448..1da0b4323c 100644 --- a/crates/language_selector/src/active_buffer_language.rs +++ b/crates/language_selector/src/active_buffer_language.rs @@ -27,8 +27,9 @@ impl ActiveBufferLanguage { } fn update_language(&mut self, editor: ViewHandle, cx: &mut ViewContext) { - let editor = editor.read(cx); self.active_language.take(); + + let editor = editor.read(cx); if let Some((_, buffer, _)) = editor.active_excerpt(cx) { if let Some(language) = buffer.read(cx).language() { self.active_language = Some(language.name());