Add setting to hide active language button in the status bar (#33977)
Release Notes: - Added settings status_bar.show_active_language_button to show/hide the language button in the status bar. The motivation for this is visual, I have had zero issues with its functionality. The language switcher can still be accessed by the command palette, menu, or a keyboard shortcut. ------ This is my first Zed and first Rust PR, so criticism is very welcome. I know there has been discussion around how the status bar settings are structured and named, and I am happy to change it to whatever is best. I was also not sure what order to put it in in the settings default.json. Feedback welcome. Here is a picture of it in action:  --------- Co-authored-by: zumbalogy <3770982+zumbalogy@users.noreply.github.com> Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
parent
0169bddb59
commit
2c7251e4f9
5 changed files with 57 additions and 1 deletions
|
@ -1,8 +1,9 @@
|
|||
use editor::Editor;
|
||||
use editor::{Editor, EditorSettings};
|
||||
use gpui::{
|
||||
Context, Entity, IntoElement, ParentElement, Render, Subscription, WeakEntity, Window, div,
|
||||
};
|
||||
use language::LanguageName;
|
||||
use settings::Settings as _;
|
||||
use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, Tooltip};
|
||||
use workspace::{StatusItemView, Workspace, item::ItemHandle};
|
||||
|
||||
|
@ -39,6 +40,13 @@ impl ActiveBufferLanguage {
|
|||
|
||||
impl Render for ActiveBufferLanguage {
|
||||
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
if !EditorSettings::get_global(cx)
|
||||
.status_bar
|
||||
.active_language_button
|
||||
{
|
||||
return div();
|
||||
}
|
||||
|
||||
div().when_some(self.active_language.as_ref(), |el, active_language| {
|
||||
let active_language_text = if let Some(active_language_text) = active_language {
|
||||
active_language_text.to_string()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue