diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs index 1da0b4323c..ce9fd5a3b0 100644 --- a/crates/language_selector/src/active_buffer_language.rs +++ b/crates/language_selector/src/active_buffer_language.rs @@ -50,21 +50,23 @@ impl View for ActiveBufferLanguage { } fn render(&mut self, cx: &mut RenderContext) -> ElementBox { - if let Some(active_language) = self.active_language.as_ref() { - MouseEventHandler::::new(0, cx, |state, cx| { - let theme = &cx.global::().theme.workspace.status_bar; - let style = theme.active_language.style_for(state, false); - Label::new(active_language.to_string(), style.text.clone()) - .contained() - .with_style(style.container) - .boxed() - }) - .with_cursor_style(CursorStyle::PointingHand) - .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle)) - .boxed() + let active_language = if let Some(active_language) = self.active_language.as_ref() { + active_language.to_string() } else { - Empty::new().boxed() - } + "Unkown".to_string() + }; + + MouseEventHandler::::new(0, cx, |state, cx| { + let theme = &cx.global::().theme.workspace.status_bar; + let style = theme.active_language.style_for(state, false); + Label::new(active_language, style.text.clone()) + .contained() + .with_style(style.container) + .boxed() + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(crate::Toggle)) + .boxed() } }