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:
parent
8a1e795746
commit
a0bd25f218
4 changed files with 13 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -9015,6 +9015,7 @@ dependencies = [
|
|||
"collections",
|
||||
"copilot",
|
||||
"editor",
|
||||
"feature_flags",
|
||||
"futures 0.3.31",
|
||||
"gpui",
|
||||
"itertools 0.14.0",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -2484,11 +2484,11 @@ impl LocalLspStore {
|
|||
}
|
||||
}
|
||||
};
|
||||
let lsp_tool = self.weak.clone();
|
||||
let lsp_store = self.weak.clone();
|
||||
let server_name = server_node.name();
|
||||
let buffer_abs_path = abs_path.to_string_lossy().to_string();
|
||||
cx.defer(move |cx| {
|
||||
lsp_tool.update(cx, |_, cx| cx.emit(LspStoreEvent::LanguageServerUpdate {
|
||||
lsp_store.update(cx, |_, cx| cx.emit(LspStoreEvent::LanguageServerUpdate {
|
||||
language_server_id: server_id,
|
||||
name: server_name,
|
||||
message: proto::update_language_server::Variant::RegisteredForBuffer(proto::RegisteredForBuffer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue