Redact environment variables in server info view (#43436)
Follow-up of https://github.com/zed-industries/zed/pull/42831 Release Notes: - N/A
This commit is contained in:
@@ -5,6 +5,7 @@ use gpui::{
|
||||
App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, ParentElement,
|
||||
Render, Styled, Subscription, Task, WeakEntity, Window, actions, div,
|
||||
};
|
||||
use itertools::Itertools as _;
|
||||
use language::{LanguageServerId, language_settings::SoftWrap};
|
||||
use lsp::{
|
||||
LanguageServer, LanguageServerName, LanguageServerSelector, MessageType, SetTraceParams,
|
||||
@@ -12,10 +13,7 @@ use lsp::{
|
||||
};
|
||||
use project::{
|
||||
LanguageServerStatus, Project,
|
||||
lsp_store::{
|
||||
LanguageServerBinaryInfo,
|
||||
log_store::{self, Event, LanguageServerKind, LogKind, LogStore, Message},
|
||||
},
|
||||
lsp_store::log_store::{self, Event, LanguageServerKind, LogKind, LogStore, Message},
|
||||
search::SearchQuery,
|
||||
};
|
||||
use proto::toggle_lsp_logs::LogType;
|
||||
@@ -351,12 +349,8 @@ impl LspLogView {
|
||||
.status
|
||||
.workspace_folders
|
||||
.iter()
|
||||
.filter_map(|uri| {
|
||||
uri.to_file_path()
|
||||
.ok()
|
||||
.map(|path| path.to_string_lossy().into_owned())
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.filter_map(|uri| uri.to_file_path().ok())
|
||||
.map(|path| path.to_string_lossy().into_owned())
|
||||
.join(", "),
|
||||
CAPABILITIES = serde_json::to_string_pretty(&info.capabilities)
|
||||
.unwrap_or_else(|e| format!("Failed to serialize capabilities: {e}")),
|
||||
@@ -968,7 +962,7 @@ impl Render for LspLogToolbarItemView {
|
||||
for (server_id, name, worktree_root, active_entry_kind) in
|
||||
available_language_servers.iter()
|
||||
{
|
||||
let label = format!("{} ({})", name, worktree_root);
|
||||
let label = format!("{name} ({worktree_root})");
|
||||
let server_id = *server_id;
|
||||
let active_entry_kind = *active_entry_kind;
|
||||
menu = menu.entry(
|
||||
@@ -1338,16 +1332,7 @@ impl ServerInfo {
|
||||
has_pending_diagnostic_updates: false,
|
||||
progress_tokens: Default::default(),
|
||||
worktree: None,
|
||||
binary: Some(LanguageServerBinaryInfo {
|
||||
path: server.binary().path.to_string_lossy().into_owned(),
|
||||
arguments: server
|
||||
.binary()
|
||||
.arguments
|
||||
.iter()
|
||||
.map(|arg| arg.to_string_lossy().into_owned())
|
||||
.collect(),
|
||||
env: server.binary().env.clone(),
|
||||
}),
|
||||
binary: Some(server.binary().clone()),
|
||||
configuration: Some(server.configuration().clone()),
|
||||
workspace_folders: server.workspace_folders(),
|
||||
},
|
||||
|
||||
@@ -62,7 +62,7 @@ pub enum IoKind {
|
||||
|
||||
/// Represents a launchable language server. This can either be a standalone binary or the path
|
||||
/// to a runtime with arguments to instruct it to launch the actual language server file.
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Serialize)]
|
||||
pub struct LanguageServerBinary {
|
||||
pub path: PathBuf,
|
||||
pub arguments: Vec<OsString>,
|
||||
|
||||
@@ -3729,13 +3729,6 @@ pub enum LspStoreEvent {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct LanguageServerBinaryInfo {
|
||||
pub path: String,
|
||||
pub arguments: Vec<String>,
|
||||
pub env: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct LanguageServerStatus {
|
||||
pub name: LanguageServerName,
|
||||
@@ -3743,7 +3736,7 @@ pub struct LanguageServerStatus {
|
||||
pub has_pending_diagnostic_updates: bool,
|
||||
pub progress_tokens: HashSet<ProgressToken>,
|
||||
pub worktree: Option<WorktreeId>,
|
||||
pub binary: Option<LanguageServerBinaryInfo>,
|
||||
pub binary: Option<LanguageServerBinary>,
|
||||
pub configuration: Option<Value>,
|
||||
pub workspace_folders: BTreeSet<Uri>,
|
||||
}
|
||||
@@ -11187,16 +11180,7 @@ impl LspStore {
|
||||
has_pending_diagnostic_updates: false,
|
||||
progress_tokens: Default::default(),
|
||||
worktree: Some(key.worktree_id),
|
||||
binary: Some(LanguageServerBinaryInfo {
|
||||
path: language_server.binary().path.to_string_lossy().into_owned(),
|
||||
arguments: language_server
|
||||
.binary()
|
||||
.arguments
|
||||
.iter()
|
||||
.map(|arg| arg.to_string_lossy().into_owned())
|
||||
.collect(),
|
||||
env: language_server.binary().env.clone(),
|
||||
}),
|
||||
binary: Some(language_server.binary().clone()),
|
||||
configuration: Some(language_server.configuration().clone()),
|
||||
workspace_folders: language_server.workspace_folders(),
|
||||
},
|
||||
|
||||
@@ -37,7 +37,7 @@ use dap::inline_value::{InlineValueLocation, VariableLookupKind, VariableScope};
|
||||
|
||||
use crate::{
|
||||
git_store::GitStore,
|
||||
lsp_store::{LanguageServerBinaryInfo, SymbolLocation, log_store::LogKind},
|
||||
lsp_store::{SymbolLocation, log_store::LogKind},
|
||||
project_search::SearchResultsHandle,
|
||||
};
|
||||
pub use agent_server_store::{AgentServerStore, AgentServersUpdated, ExternalAgentServerName};
|
||||
@@ -87,7 +87,8 @@ use language::{
|
||||
};
|
||||
use lsp::{
|
||||
CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, InsertTextMode,
|
||||
LanguageServerId, LanguageServerName, LanguageServerSelector, MessageActionItem,
|
||||
LanguageServerBinary, LanguageServerId, LanguageServerName, LanguageServerSelector,
|
||||
MessageActionItem,
|
||||
};
|
||||
use lsp_command::*;
|
||||
use lsp_store::{CompletionDocumentation, LspFormatTarget, OpenLspBufferHandle};
|
||||
@@ -111,6 +112,7 @@ use snippet_provider::SnippetProvider;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::BTreeMap,
|
||||
ffi::OsString,
|
||||
ops::{Not as _, Range},
|
||||
path::{Path, PathBuf},
|
||||
pin::pin,
|
||||
@@ -3125,12 +3127,15 @@ impl Project {
|
||||
.get_mut(language_server_id)
|
||||
{
|
||||
if let Some(binary) = &update.binary {
|
||||
language_server_status.binary =
|
||||
Some(LanguageServerBinaryInfo {
|
||||
path: binary.path.clone(),
|
||||
arguments: binary.arguments.clone(),
|
||||
env: None,
|
||||
});
|
||||
language_server_status.binary = Some(LanguageServerBinary {
|
||||
path: PathBuf::from(&binary.path),
|
||||
arguments: binary
|
||||
.arguments
|
||||
.iter()
|
||||
.map(OsString::from)
|
||||
.collect(),
|
||||
env: None,
|
||||
});
|
||||
}
|
||||
|
||||
language_server_status.configuration = update
|
||||
|
||||
Reference in New Issue
Block a user