Feature gate the LSP button (#33463)

Follow-up of https://github.com/zed-industries/zed/pull/32490

The tool still looks like designed by professional developers, and still
may change its UX based on the internal feedback.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-06-26 18:41:42 +03:00 committed by GitHub
parent 8a1e795746
commit a0bd25f218
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 2 deletions

View file

@ -18,6 +18,7 @@ client.workspace = true
collections.workspace = true
copilot.workspace = true
editor.workspace = true
feature_flags.workspace = true
futures.workspace = true
gpui.workspace = true
itertools.workspace = true

View file

@ -3,6 +3,7 @@ use std::{collections::hash_map, path::PathBuf, sync::Arc, time::Duration};
use client::proto;
use collections::{HashMap, HashSet};
use editor::{Editor, EditorEvent};
use feature_flags::FeatureFlagAppExt as _;
use gpui::{Corner, DismissEvent, Entity, Focusable as _, Subscription, Task, WeakEntity, actions};
use language::{BinaryStatus, BufferId, LocalFile, ServerHealth};
use lsp::{LanguageServerId, LanguageServerName, LanguageServerSelector};
@ -244,6 +245,10 @@ impl LanguageServers {
);
}
}
fn is_empty(&self) -> bool {
self.binary_statuses.is_empty() && self.health_statuses.is_empty()
}
}
#[derive(Debug)]
@ -865,6 +870,10 @@ impl StatusItemView for LspTool {
impl Render for LspTool {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl ui::IntoElement {
if !cx.is_staff() || self.state.read(cx).language_servers.is_empty() {
return div();
}
let Some(lsp_picker) = self.lsp_picker.clone() else {
return div();
};