mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
This reverts commit e2bf8e5d9c.
See
https://github.com/zed-industries/zed/pull/37050#issuecomment-3230017137
for the context: musl builds started to fail and the amount of `cfg!`s
to fix this is too large.
Instead, the lsp_log.rs has to be split and repurposed better for the
remote headless server.
Release Notes:
- N/A
This commit is contained in:
parent
9a97f9465b
commit
b233df8343
29 changed files with 347 additions and 954 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -9213,7 +9213,6 @@ dependencies = [
|
||||||
"language",
|
"language",
|
||||||
"lsp",
|
"lsp",
|
||||||
"project",
|
"project",
|
||||||
"proto",
|
|
||||||
"release_channel",
|
"release_channel",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"settings",
|
"settings",
|
||||||
|
|
@ -13501,7 +13500,6 @@ dependencies = [
|
||||||
"language",
|
"language",
|
||||||
"language_extension",
|
"language_extension",
|
||||||
"language_model",
|
"language_model",
|
||||||
"language_tools",
|
|
||||||
"languages",
|
"languages",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ parking_lot.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
workspace = { path = "../workspace", default-features = false }
|
workspace.workspace = true
|
||||||
workspace-hack.workspace = true
|
workspace-hack.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
text.workspace = true
|
text.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
workspace = { path = "../workspace", default-features = false }
|
workspace.workspace = true
|
||||||
workspace-hack.workspace = true
|
workspace-hack.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ itertools.workspace = true
|
||||||
settings.workspace = true
|
settings.workspace = true
|
||||||
theme.workspace = true
|
theme.workspace = true
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
workspace = { path = "../workspace", default-features = false }
|
workspace.workspace = true
|
||||||
zed_actions.workspace = true
|
zed_actions.workspace = true
|
||||||
workspace-hack.workspace = true
|
workspace-hack.workspace = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,6 @@ CREATE TABLE "language_servers" (
|
||||||
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
"project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
|
||||||
"name" VARCHAR NOT NULL,
|
"name" VARCHAR NOT NULL,
|
||||||
"capabilities" TEXT NOT NULL,
|
"capabilities" TEXT NOT NULL,
|
||||||
"worktree_id" BIGINT,
|
|
||||||
PRIMARY KEY (project_id, id)
|
PRIMARY KEY (project_id, id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE language_servers
|
|
||||||
ADD COLUMN worktree_id BIGINT;
|
|
||||||
|
|
@ -694,7 +694,6 @@ impl Database {
|
||||||
project_id: ActiveValue::set(project_id),
|
project_id: ActiveValue::set(project_id),
|
||||||
id: ActiveValue::set(server.id as i64),
|
id: ActiveValue::set(server.id as i64),
|
||||||
name: ActiveValue::set(server.name.clone()),
|
name: ActiveValue::set(server.name.clone()),
|
||||||
worktree_id: ActiveValue::set(server.worktree_id.map(|id| id as i64)),
|
|
||||||
capabilities: ActiveValue::set(update.capabilities.clone()),
|
capabilities: ActiveValue::set(update.capabilities.clone()),
|
||||||
})
|
})
|
||||||
.on_conflict(
|
.on_conflict(
|
||||||
|
|
@ -705,7 +704,6 @@ impl Database {
|
||||||
.update_columns([
|
.update_columns([
|
||||||
language_server::Column::Name,
|
language_server::Column::Name,
|
||||||
language_server::Column::Capabilities,
|
language_server::Column::Capabilities,
|
||||||
language_server::Column::WorktreeId,
|
|
||||||
])
|
])
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
|
@ -1067,7 +1065,7 @@ impl Database {
|
||||||
server: proto::LanguageServer {
|
server: proto::LanguageServer {
|
||||||
id: language_server.id as u64,
|
id: language_server.id as u64,
|
||||||
name: language_server.name,
|
name: language_server.name,
|
||||||
worktree_id: language_server.worktree_id.map(|id| id as u64),
|
worktree_id: None,
|
||||||
},
|
},
|
||||||
capabilities: language_server.capabilities,
|
capabilities: language_server.capabilities,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -809,7 +809,7 @@ impl Database {
|
||||||
server: proto::LanguageServer {
|
server: proto::LanguageServer {
|
||||||
id: language_server.id as u64,
|
id: language_server.id as u64,
|
||||||
name: language_server.name,
|
name: language_server.name,
|
||||||
worktree_id: language_server.worktree_id.map(|id| id as u64),
|
worktree_id: None,
|
||||||
},
|
},
|
||||||
capabilities: language_server.capabilities,
|
capabilities: language_server.capabilities,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ pub struct Model {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub capabilities: String,
|
pub capabilities: String,
|
||||||
pub worktree_id: Option<i64>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|
|
||||||
|
|
@ -476,9 +476,7 @@ impl Server {
|
||||||
.add_request_handler(forward_mutating_project_request::<proto::GitChangeBranch>)
|
.add_request_handler(forward_mutating_project_request::<proto::GitChangeBranch>)
|
||||||
.add_request_handler(forward_mutating_project_request::<proto::CheckForPushedCommits>)
|
.add_request_handler(forward_mutating_project_request::<proto::CheckForPushedCommits>)
|
||||||
.add_message_handler(broadcast_project_message_from_host::<proto::AdvertiseContexts>)
|
.add_message_handler(broadcast_project_message_from_host::<proto::AdvertiseContexts>)
|
||||||
.add_message_handler(update_context)
|
.add_message_handler(update_context);
|
||||||
.add_request_handler(forward_mutating_project_request::<proto::ToggleLspLogs>)
|
|
||||||
.add_message_handler(broadcast_project_message_from_host::<proto::LanguageServerLog>);
|
|
||||||
|
|
||||||
Arc::new(server)
|
Arc::new(server)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ sum_tree.workspace = true
|
||||||
task.workspace = true
|
task.workspace = true
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
workspace = { path = "../workspace", default-features = false }
|
workspace.workspace = true
|
||||||
workspace-hack.workspace = true
|
workspace-hack.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ ui.workspace = true
|
||||||
url.workspace = true
|
url.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
uuid.workspace = true
|
uuid.workspace = true
|
||||||
workspace = { path = "../workspace", default-features = false }
|
workspace.workspace = true
|
||||||
zed_actions.workspace = true
|
zed_actions.workspace = true
|
||||||
workspace-hack.workspace = true
|
workspace-hack.workspace = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,13 @@ itertools.workspace = true
|
||||||
language.workspace = true
|
language.workspace = true
|
||||||
lsp.workspace = true
|
lsp.workspace = true
|
||||||
project.workspace = true
|
project.workspace = true
|
||||||
proto.workspace = true
|
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
settings.workspace = true
|
settings.workspace = true
|
||||||
theme.workspace = true
|
theme.workspace = true
|
||||||
tree-sitter.workspace = true
|
tree-sitter.workspace = true
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
util.workspace = true
|
util.workspace = true
|
||||||
workspace = { path = "../workspace", default-features = false }
|
workspace.workspace = true
|
||||||
zed_actions.workspace = true
|
zed_actions.workspace = true
|
||||||
workspace-hack.workspace = true
|
workspace-hack.workspace = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
mod key_context_view;
|
mod key_context_view;
|
||||||
pub mod lsp_log;
|
mod lsp_log;
|
||||||
pub mod lsp_tool;
|
pub mod lsp_tool;
|
||||||
mod syntax_tree_view;
|
mod syntax_tree_view;
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ use ui::{Context, Window};
|
||||||
use workspace::{Item, ItemHandle, SplitDirection, Workspace};
|
use workspace::{Item, ItemHandle, SplitDirection, Workspace};
|
||||||
|
|
||||||
pub fn init(cx: &mut App) {
|
pub fn init(cx: &mut App) {
|
||||||
lsp_log::init(true, cx);
|
lsp_log::init(cx);
|
||||||
syntax_tree_view::init(cx);
|
syntax_tree_view::init(cx);
|
||||||
key_context_view::init(cx);
|
key_context_view::init(cx);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -51,7 +51,7 @@ async fn test_lsp_logs(cx: &mut TestAppContext) {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let log_store = cx.new(|cx| LogStore::new(true, cx));
|
let log_store = cx.new(LogStore::new);
|
||||||
log_store.update(cx, |store, cx| store.add_project(&project, cx));
|
log_store.update(cx, |store, cx| store.add_project(&project, cx));
|
||||||
|
|
||||||
let _rust_buffer = project
|
let _rust_buffer = project
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,8 @@ impl LanguageServerState {
|
||||||
let lsp_logs = cx
|
let lsp_logs = cx
|
||||||
.try_global::<GlobalLogStore>()
|
.try_global::<GlobalLogStore>()
|
||||||
.and_then(|lsp_logs| lsp_logs.0.upgrade());
|
.and_then(|lsp_logs| lsp_logs.0.upgrade());
|
||||||
let Some(lsp_logs) = lsp_logs else {
|
let lsp_store = self.lsp_store.upgrade();
|
||||||
|
let Some((lsp_logs, lsp_store)) = lsp_logs.zip(lsp_store) else {
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -209,11 +210,10 @@ impl LanguageServerState {
|
||||||
};
|
};
|
||||||
|
|
||||||
let server_selector = server_info.server_selector();
|
let server_selector = server_info.server_selector();
|
||||||
let is_remote = self
|
// TODO currently, Zed remote does not work well with the LSP logs
|
||||||
.lsp_store
|
// https://github.com/zed-industries/zed/issues/28557
|
||||||
.update(cx, |lsp_store, _| lsp_store.as_remote().is_some())
|
let has_logs = lsp_store.read(cx).as_local().is_some()
|
||||||
.unwrap_or(false);
|
&& lsp_logs.read(cx).has_server_logs(&server_selector);
|
||||||
let has_logs = is_remote || lsp_logs.read(cx).has_server_logs(&server_selector);
|
|
||||||
|
|
||||||
let status_color = server_info
|
let status_color = server_info
|
||||||
.binary_status
|
.binary_status
|
||||||
|
|
@ -241,10 +241,10 @@ impl LanguageServerState {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.or_else(|| server_info.binary_status.as_ref()?.message.as_ref())
|
.or_else(|| server_info.binary_status.as_ref()?.message.as_ref())
|
||||||
.cloned();
|
.cloned();
|
||||||
let hover_label = if message.is_some() {
|
let hover_label = if has_logs {
|
||||||
Some("View Message")
|
|
||||||
} else if has_logs {
|
|
||||||
Some("View Logs")
|
Some("View Logs")
|
||||||
|
} else if message.is_some() {
|
||||||
|
Some("View Message")
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
@ -288,7 +288,16 @@ impl LanguageServerState {
|
||||||
let server_name = server_info.name.clone();
|
let server_name = server_info.name.clone();
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
move |window, cx| {
|
move |window, cx| {
|
||||||
if let Some(message) = &message {
|
if has_logs {
|
||||||
|
lsp_logs.update(cx, |lsp_logs, cx| {
|
||||||
|
lsp_logs.open_server_trace(
|
||||||
|
workspace.clone(),
|
||||||
|
server_selector.clone(),
|
||||||
|
window,
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else if let Some(message) = &message {
|
||||||
let Some(create_buffer) = workspace
|
let Some(create_buffer) = workspace
|
||||||
.update(cx, |workspace, cx| {
|
.update(cx, |workspace, cx| {
|
||||||
workspace
|
workspace
|
||||||
|
|
@ -338,15 +347,6 @@ impl LanguageServerState {
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
} else if has_logs {
|
|
||||||
lsp_logs.update(cx, |lsp_logs, cx| {
|
|
||||||
lsp_logs.open_server_trace(
|
|
||||||
workspace.clone(),
|
|
||||||
server_selector.clone(),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
}
|
}
|
||||||
|
|
@ -529,48 +529,26 @@ impl LspTool {
|
||||||
});
|
});
|
||||||
|
|
||||||
let lsp_store = workspace.project().read(cx).lsp_store();
|
let lsp_store = workspace.project().read(cx).lsp_store();
|
||||||
let mut language_servers = LanguageServers::default();
|
|
||||||
for (_, status) in lsp_store.read(cx).language_server_statuses() {
|
|
||||||
language_servers.binary_statuses.insert(
|
|
||||||
status.name.clone(),
|
|
||||||
LanguageServerBinaryStatus {
|
|
||||||
status: BinaryStatus::None,
|
|
||||||
message: None,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let lsp_store_subscription =
|
let lsp_store_subscription =
|
||||||
cx.subscribe_in(&lsp_store, window, |lsp_tool, _, e, window, cx| {
|
cx.subscribe_in(&lsp_store, window, |lsp_tool, _, e, window, cx| {
|
||||||
lsp_tool.on_lsp_store_event(e, window, cx)
|
lsp_tool.on_lsp_store_event(e, window, cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
let server_state = cx.new(|_| LanguageServerState {
|
let state = cx.new(|_| LanguageServerState {
|
||||||
workspace: workspace.weak_handle(),
|
workspace: workspace.weak_handle(),
|
||||||
items: Vec::new(),
|
items: Vec::new(),
|
||||||
lsp_store: lsp_store.downgrade(),
|
lsp_store: lsp_store.downgrade(),
|
||||||
active_editor: None,
|
active_editor: None,
|
||||||
language_servers,
|
language_servers: LanguageServers::default(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut lsp_tool = Self {
|
Self {
|
||||||
server_state,
|
server_state: state,
|
||||||
popover_menu_handle,
|
popover_menu_handle,
|
||||||
lsp_menu: None,
|
lsp_menu: None,
|
||||||
lsp_menu_refresh: Task::ready(()),
|
lsp_menu_refresh: Task::ready(()),
|
||||||
_subscriptions: vec![settings_subscription, lsp_store_subscription],
|
_subscriptions: vec![settings_subscription, lsp_store_subscription],
|
||||||
};
|
|
||||||
if !lsp_tool
|
|
||||||
.server_state
|
|
||||||
.read(cx)
|
|
||||||
.language_servers
|
|
||||||
.binary_statuses
|
|
||||||
.is_empty()
|
|
||||||
{
|
|
||||||
lsp_tool.refresh_lsp_menu(true, window, cx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lsp_tool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_lsp_store_event(
|
fn on_lsp_store_event(
|
||||||
|
|
@ -730,25 +708,6 @@ impl LspTool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state
|
|
||||||
.lsp_store
|
|
||||||
.update(cx, |lsp_store, cx| {
|
|
||||||
for (server_id, status) in lsp_store.language_server_statuses() {
|
|
||||||
if let Some(worktree) = status.worktree.and_then(|worktree_id| {
|
|
||||||
lsp_store
|
|
||||||
.worktree_store()
|
|
||||||
.read(cx)
|
|
||||||
.worktree_for_id(worktree_id, cx)
|
|
||||||
}) {
|
|
||||||
server_ids_to_worktrees.insert(server_id, worktree.clone());
|
|
||||||
server_names_to_worktrees
|
|
||||||
.entry(status.name.clone())
|
|
||||||
.or_default()
|
|
||||||
.insert((worktree, server_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.ok();
|
|
||||||
|
|
||||||
let mut servers_per_worktree = BTreeMap::<SharedString, Vec<ServerData>>::new();
|
let mut servers_per_worktree = BTreeMap::<SharedString, Vec<ServerData>>::new();
|
||||||
let mut servers_without_worktree = Vec::<ServerData>::new();
|
let mut servers_without_worktree = Vec::<ServerData>::new();
|
||||||
|
|
|
||||||
|
|
@ -977,9 +977,7 @@ impl LocalLspStore {
|
||||||
this.update(&mut cx, |_, cx| {
|
this.update(&mut cx, |_, cx| {
|
||||||
cx.emit(LspStoreEvent::LanguageServerLog(
|
cx.emit(LspStoreEvent::LanguageServerLog(
|
||||||
server_id,
|
server_id,
|
||||||
LanguageServerLogType::Trace {
|
LanguageServerLogType::Trace(params.verbose),
|
||||||
verbose_info: params.verbose,
|
|
||||||
},
|
|
||||||
params.message,
|
params.message,
|
||||||
));
|
));
|
||||||
})
|
})
|
||||||
|
|
@ -3484,13 +3482,13 @@ pub struct LspStore {
|
||||||
buffer_store: Entity<BufferStore>,
|
buffer_store: Entity<BufferStore>,
|
||||||
worktree_store: Entity<WorktreeStore>,
|
worktree_store: Entity<WorktreeStore>,
|
||||||
pub languages: Arc<LanguageRegistry>,
|
pub languages: Arc<LanguageRegistry>,
|
||||||
pub language_server_statuses: BTreeMap<LanguageServerId, LanguageServerStatus>,
|
language_server_statuses: BTreeMap<LanguageServerId, LanguageServerStatus>,
|
||||||
active_entry: Option<ProjectEntryId>,
|
active_entry: Option<ProjectEntryId>,
|
||||||
_maintain_workspace_config: (Task<Result<()>>, watch::Sender<()>),
|
_maintain_workspace_config: (Task<Result<()>>, watch::Sender<()>),
|
||||||
_maintain_buffer_languages: Task<()>,
|
_maintain_buffer_languages: Task<()>,
|
||||||
diagnostic_summaries:
|
diagnostic_summaries:
|
||||||
HashMap<WorktreeId, HashMap<Arc<Path>, HashMap<LanguageServerId, DiagnosticSummary>>>,
|
HashMap<WorktreeId, HashMap<Arc<Path>, HashMap<LanguageServerId, DiagnosticSummary>>>,
|
||||||
pub lsp_server_capabilities: HashMap<LanguageServerId, lsp::ServerCapabilities>,
|
pub(super) lsp_server_capabilities: HashMap<LanguageServerId, lsp::ServerCapabilities>,
|
||||||
lsp_document_colors: HashMap<BufferId, DocumentColorData>,
|
lsp_document_colors: HashMap<BufferId, DocumentColorData>,
|
||||||
lsp_code_lens: HashMap<BufferId, CodeLensData>,
|
lsp_code_lens: HashMap<BufferId, CodeLensData>,
|
||||||
running_lsp_requests: HashMap<TypeId, (Global, HashMap<LspRequestId, Task<()>>)>,
|
running_lsp_requests: HashMap<TypeId, (Global, HashMap<LspRequestId, Task<()>>)>,
|
||||||
|
|
@ -3567,7 +3565,6 @@ pub struct LanguageServerStatus {
|
||||||
pub pending_work: BTreeMap<String, LanguageServerProgress>,
|
pub pending_work: BTreeMap<String, LanguageServerProgress>,
|
||||||
pub has_pending_diagnostic_updates: bool,
|
pub has_pending_diagnostic_updates: bool,
|
||||||
progress_tokens: HashSet<String>,
|
progress_tokens: HashSet<String>,
|
||||||
pub worktree: Option<WorktreeId>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
@ -7486,7 +7483,7 @@ impl LspStore {
|
||||||
server: Some(proto::LanguageServer {
|
server: Some(proto::LanguageServer {
|
||||||
id: server_id.to_proto(),
|
id: server_id.to_proto(),
|
||||||
name: status.name.to_string(),
|
name: status.name.to_string(),
|
||||||
worktree_id: status.worktree.map(|id| id.to_proto()),
|
worktree_id: None,
|
||||||
}),
|
}),
|
||||||
capabilities: serde_json::to_string(&server.capabilities())
|
capabilities: serde_json::to_string(&server.capabilities())
|
||||||
.expect("serializing server LSP capabilities"),
|
.expect("serializing server LSP capabilities"),
|
||||||
|
|
@ -7530,7 +7527,6 @@ impl LspStore {
|
||||||
pending_work: Default::default(),
|
pending_work: Default::default(),
|
||||||
has_pending_diagnostic_updates: false,
|
has_pending_diagnostic_updates: false,
|
||||||
progress_tokens: Default::default(),
|
progress_tokens: Default::default(),
|
||||||
worktree: server.worktree_id.map(WorktreeId::from_proto),
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -8896,7 +8892,6 @@ impl LspStore {
|
||||||
pending_work: Default::default(),
|
pending_work: Default::default(),
|
||||||
has_pending_diagnostic_updates: false,
|
has_pending_diagnostic_updates: false,
|
||||||
progress_tokens: Default::default(),
|
progress_tokens: Default::default(),
|
||||||
worktree: server.worktree_id.map(WorktreeId::from_proto),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
cx.emit(LspStoreEvent::LanguageServerAdded(
|
cx.emit(LspStoreEvent::LanguageServerAdded(
|
||||||
|
|
@ -10910,7 +10905,6 @@ impl LspStore {
|
||||||
pending_work: Default::default(),
|
pending_work: Default::default(),
|
||||||
has_pending_diagnostic_updates: false,
|
has_pending_diagnostic_updates: false,
|
||||||
progress_tokens: Default::default(),
|
progress_tokens: Default::default(),
|
||||||
worktree: Some(key.worktree_id),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -12196,14 +12190,6 @@ impl LspStore {
|
||||||
let data = self.lsp_code_lens.get_mut(&buffer_id)?;
|
let data = self.lsp_code_lens.get_mut(&buffer_id)?;
|
||||||
Some(data.update.take()?.1)
|
Some(data.update.take()?.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn downstream_client(&self) -> Option<(AnyProtoClient, u64)> {
|
|
||||||
self.downstream_client.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn worktree_store(&self) -> Entity<WorktreeStore> {
|
|
||||||
self.worktree_store.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registration with registerOptions as null, should fallback to true.
|
// Registration with registerOptions as null, should fallback to true.
|
||||||
|
|
@ -12713,69 +12699,45 @@ impl PartialEq for LanguageServerPromptRequest {
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub enum LanguageServerLogType {
|
pub enum LanguageServerLogType {
|
||||||
Log(MessageType),
|
Log(MessageType),
|
||||||
Trace { verbose_info: Option<String> },
|
Trace(Option<String>),
|
||||||
Rpc { received: bool },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LanguageServerLogType {
|
impl LanguageServerLogType {
|
||||||
pub fn to_proto(&self) -> proto::language_server_log::LogType {
|
pub fn to_proto(&self) -> proto::language_server_log::LogType {
|
||||||
match self {
|
match self {
|
||||||
Self::Log(log_type) => {
|
Self::Log(log_type) => {
|
||||||
use proto::log_message::LogLevel;
|
let message_type = match *log_type {
|
||||||
let level = match *log_type {
|
MessageType::ERROR => 1,
|
||||||
MessageType::ERROR => LogLevel::Error,
|
MessageType::WARNING => 2,
|
||||||
MessageType::WARNING => LogLevel::Warning,
|
MessageType::INFO => 3,
|
||||||
MessageType::INFO => LogLevel::Info,
|
MessageType::LOG => 4,
|
||||||
MessageType::LOG => LogLevel::Log,
|
|
||||||
other => {
|
other => {
|
||||||
log::warn!("Unknown lsp log message type: {other:?}");
|
log::warn!("Unknown lsp log message type: {:?}", other);
|
||||||
LogLevel::Log
|
4
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
proto::language_server_log::LogType::Log(proto::LogMessage {
|
proto::language_server_log::LogType::LogMessageType(message_type)
|
||||||
level: level as i32,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
Self::Trace { verbose_info } => {
|
Self::Trace(message) => {
|
||||||
proto::language_server_log::LogType::Trace(proto::TraceMessage {
|
proto::language_server_log::LogType::LogTrace(proto::LspLogTrace {
|
||||||
verbose_info: verbose_info.to_owned(),
|
message: message.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Self::Rpc { received } => {
|
|
||||||
let kind = if *received {
|
|
||||||
proto::rpc_message::Kind::Received
|
|
||||||
} else {
|
|
||||||
proto::rpc_message::Kind::Sent
|
|
||||||
};
|
|
||||||
let kind = kind as i32;
|
|
||||||
proto::language_server_log::LogType::Rpc(proto::RpcMessage { kind })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_proto(log_type: proto::language_server_log::LogType) -> Self {
|
pub fn from_proto(log_type: proto::language_server_log::LogType) -> Self {
|
||||||
use proto::log_message::LogLevel;
|
|
||||||
use proto::rpc_message;
|
|
||||||
match log_type {
|
match log_type {
|
||||||
proto::language_server_log::LogType::Log(message_type) => Self::Log(
|
proto::language_server_log::LogType::LogMessageType(message_type) => {
|
||||||
match LogLevel::from_i32(message_type.level).unwrap_or(LogLevel::Log) {
|
Self::Log(match message_type {
|
||||||
LogLevel::Error => MessageType::ERROR,
|
1 => MessageType::ERROR,
|
||||||
LogLevel::Warning => MessageType::WARNING,
|
2 => MessageType::WARNING,
|
||||||
LogLevel::Info => MessageType::INFO,
|
3 => MessageType::INFO,
|
||||||
LogLevel::Log => MessageType::LOG,
|
4 => MessageType::LOG,
|
||||||
},
|
_ => MessageType::LOG,
|
||||||
),
|
})
|
||||||
proto::language_server_log::LogType::Trace(trace_message) => Self::Trace {
|
}
|
||||||
verbose_info: trace_message.verbose_info,
|
proto::language_server_log::LogType::LogTrace(trace) => Self::Trace(trace.message),
|
||||||
},
|
|
||||||
proto::language_server_log::LogType::Rpc(message) => Self::Rpc {
|
|
||||||
received: match rpc_message::Kind::from_i32(message.kind)
|
|
||||||
.unwrap_or(rpc_message::Kind::Received)
|
|
||||||
{
|
|
||||||
rpc_message::Kind::Received => true,
|
|
||||||
rpc_message::Kind::Sent => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -280,11 +280,6 @@ pub enum Event {
|
||||||
server_id: LanguageServerId,
|
server_id: LanguageServerId,
|
||||||
buffer_id: BufferId,
|
buffer_id: BufferId,
|
||||||
buffer_abs_path: PathBuf,
|
buffer_abs_path: PathBuf,
|
||||||
name: Option<LanguageServerName>,
|
|
||||||
},
|
|
||||||
ToggleLspLogs {
|
|
||||||
server_id: LanguageServerId,
|
|
||||||
enabled: bool,
|
|
||||||
},
|
},
|
||||||
Toast {
|
Toast {
|
||||||
notification_id: SharedString,
|
notification_id: SharedString,
|
||||||
|
|
@ -1006,7 +1001,6 @@ impl Project {
|
||||||
client.add_entity_request_handler(Self::handle_open_buffer_by_path);
|
client.add_entity_request_handler(Self::handle_open_buffer_by_path);
|
||||||
client.add_entity_request_handler(Self::handle_open_new_buffer);
|
client.add_entity_request_handler(Self::handle_open_new_buffer);
|
||||||
client.add_entity_message_handler(Self::handle_create_buffer_for_peer);
|
client.add_entity_message_handler(Self::handle_create_buffer_for_peer);
|
||||||
client.add_entity_message_handler(Self::handle_toggle_lsp_logs);
|
|
||||||
|
|
||||||
WorktreeStore::init(&client);
|
WorktreeStore::init(&client);
|
||||||
BufferStore::init(&client);
|
BufferStore::init(&client);
|
||||||
|
|
@ -2977,7 +2971,6 @@ impl Project {
|
||||||
buffer_id,
|
buffer_id,
|
||||||
server_id: *language_server_id,
|
server_id: *language_server_id,
|
||||||
buffer_abs_path: PathBuf::from(&update.buffer_abs_path),
|
buffer_abs_path: PathBuf::from(&update.buffer_abs_path),
|
||||||
name: name.clone(),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4704,20 +4697,6 @@ impl Project {
|
||||||
})?
|
})?
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_toggle_lsp_logs(
|
|
||||||
project: Entity<Self>,
|
|
||||||
envelope: TypedEnvelope<proto::ToggleLspLogs>,
|
|
||||||
mut cx: AsyncApp,
|
|
||||||
) -> Result<()> {
|
|
||||||
project.update(&mut cx, |_, cx| {
|
|
||||||
cx.emit(Event::ToggleLspLogs {
|
|
||||||
server_id: LanguageServerId::from_proto(envelope.payload.server_id),
|
|
||||||
enabled: envelope.payload.enabled,
|
|
||||||
})
|
|
||||||
})?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn handle_synchronize_buffers(
|
async fn handle_synchronize_buffers(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::SynchronizeBuffers>,
|
envelope: TypedEnvelope<proto::SynchronizeBuffers>,
|
||||||
|
|
|
||||||
|
|
@ -1951,7 +1951,6 @@ async fn test_restarting_server_with_diagnostics_running(cx: &mut gpui::TestAppC
|
||||||
server_id: LanguageServerId(1),
|
server_id: LanguageServerId(1),
|
||||||
buffer_id,
|
buffer_id,
|
||||||
buffer_abs_path: PathBuf::from(path!("/dir/a.rs")),
|
buffer_abs_path: PathBuf::from(path!("/dir/a.rs")),
|
||||||
name: Some(fake_server.server.name())
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
||||||
|
|
@ -610,36 +610,11 @@ message ServerMetadataUpdated {
|
||||||
message LanguageServerLog {
|
message LanguageServerLog {
|
||||||
uint64 project_id = 1;
|
uint64 project_id = 1;
|
||||||
uint64 language_server_id = 2;
|
uint64 language_server_id = 2;
|
||||||
string message = 3;
|
|
||||||
oneof log_type {
|
oneof log_type {
|
||||||
LogMessage log = 4;
|
uint32 log_message_type = 3;
|
||||||
TraceMessage trace = 5;
|
LspLogTrace log_trace = 4;
|
||||||
RpcMessage rpc = 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message LogMessage {
|
|
||||||
LogLevel level = 1;
|
|
||||||
|
|
||||||
enum LogLevel {
|
|
||||||
LOG = 0;
|
|
||||||
INFO = 1;
|
|
||||||
WARNING = 2;
|
|
||||||
ERROR = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message TraceMessage {
|
|
||||||
optional string verbose_info = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RpcMessage {
|
|
||||||
Kind kind = 1;
|
|
||||||
|
|
||||||
enum Kind {
|
|
||||||
RECEIVED = 0;
|
|
||||||
SENT = 1;
|
|
||||||
}
|
}
|
||||||
|
string message = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message LspLogTrace {
|
message LspLogTrace {
|
||||||
|
|
@ -957,16 +932,3 @@ message MultiLspQuery {
|
||||||
message MultiLspQueryResponse {
|
message MultiLspQueryResponse {
|
||||||
repeated LspResponse responses = 1;
|
repeated LspResponse responses = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ToggleLspLogs {
|
|
||||||
uint64 project_id = 1;
|
|
||||||
LogType log_type = 2;
|
|
||||||
uint64 server_id = 3;
|
|
||||||
bool enabled = 4;
|
|
||||||
|
|
||||||
enum LogType {
|
|
||||||
LOG = 0;
|
|
||||||
TRACE = 1;
|
|
||||||
RPC = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -396,8 +396,7 @@ message Envelope {
|
||||||
GitCloneResponse git_clone_response = 364;
|
GitCloneResponse git_clone_response = 364;
|
||||||
|
|
||||||
LspQuery lsp_query = 365;
|
LspQuery lsp_query = 365;
|
||||||
LspQueryResponse lsp_query_response = 366;
|
LspQueryResponse lsp_query_response = 366; // current max
|
||||||
ToggleLspLogs toggle_lsp_logs = 367; // current max
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reserved 87 to 88;
|
reserved 87 to 88;
|
||||||
|
|
|
||||||
|
|
@ -312,8 +312,7 @@ messages!(
|
||||||
(GetDefaultBranch, Background),
|
(GetDefaultBranch, Background),
|
||||||
(GetDefaultBranchResponse, Background),
|
(GetDefaultBranchResponse, Background),
|
||||||
(GitClone, Background),
|
(GitClone, Background),
|
||||||
(GitCloneResponse, Background),
|
(GitCloneResponse, Background)
|
||||||
(ToggleLspLogs, Background),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
request_messages!(
|
request_messages!(
|
||||||
|
|
@ -482,8 +481,7 @@ request_messages!(
|
||||||
(GetDocumentDiagnostics, GetDocumentDiagnosticsResponse),
|
(GetDocumentDiagnostics, GetDocumentDiagnosticsResponse),
|
||||||
(PullWorkspaceDiagnostics, Ack),
|
(PullWorkspaceDiagnostics, Ack),
|
||||||
(GetDefaultBranch, GetDefaultBranchResponse),
|
(GetDefaultBranch, GetDefaultBranchResponse),
|
||||||
(GitClone, GitCloneResponse),
|
(GitClone, GitCloneResponse)
|
||||||
(ToggleLspLogs, Ack),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
lsp_messages!(
|
lsp_messages!(
|
||||||
|
|
@ -614,7 +612,6 @@ entity_messages!(
|
||||||
GitReset,
|
GitReset,
|
||||||
GitCheckoutFiles,
|
GitCheckoutFiles,
|
||||||
SetIndexText,
|
SetIndexText,
|
||||||
ToggleLspLogs,
|
|
||||||
|
|
||||||
Push,
|
Push,
|
||||||
Fetch,
|
Fetch,
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ gpui_tokio.workspace = true
|
||||||
http_client.workspace = true
|
http_client.workspace = true
|
||||||
language.workspace = true
|
language.workspace = true
|
||||||
language_extension.workspace = true
|
language_extension.workspace = true
|
||||||
language_tools.workspace = true
|
|
||||||
languages.workspace = true
|
languages.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
lsp.workspace = true
|
lsp.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
use ::proto::{FromProto, ToProto};
|
use ::proto::{FromProto, ToProto};
|
||||||
use anyhow::{Context as _, Result, anyhow};
|
use anyhow::{Context as _, Result, anyhow};
|
||||||
use language_tools::lsp_log::{GlobalLogStore, LanguageServerKind};
|
|
||||||
use lsp::LanguageServerId;
|
|
||||||
|
|
||||||
use extension::ExtensionHostProxy;
|
use extension::ExtensionHostProxy;
|
||||||
use extension_host::headless_host::HeadlessExtensionStore;
|
use extension_host::headless_host::HeadlessExtensionStore;
|
||||||
|
|
@ -67,7 +65,6 @@ impl HeadlessProject {
|
||||||
settings::init(cx);
|
settings::init(cx);
|
||||||
language::init(cx);
|
language::init(cx);
|
||||||
project::Project::init_settings(cx);
|
project::Project::init_settings(cx);
|
||||||
language_tools::lsp_log::init(false, cx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
|
@ -238,7 +235,6 @@ impl HeadlessProject {
|
||||||
session.add_entity_request_handler(Self::handle_open_new_buffer);
|
session.add_entity_request_handler(Self::handle_open_new_buffer);
|
||||||
session.add_entity_request_handler(Self::handle_find_search_candidates);
|
session.add_entity_request_handler(Self::handle_find_search_candidates);
|
||||||
session.add_entity_request_handler(Self::handle_open_server_settings);
|
session.add_entity_request_handler(Self::handle_open_server_settings);
|
||||||
session.add_entity_message_handler(Self::handle_toggle_lsp_logs);
|
|
||||||
|
|
||||||
session.add_entity_request_handler(BufferStore::handle_update_buffer);
|
session.add_entity_request_handler(BufferStore::handle_update_buffer);
|
||||||
session.add_entity_message_handler(BufferStore::handle_close_buffer);
|
session.add_entity_message_handler(BufferStore::handle_close_buffer);
|
||||||
|
|
@ -302,40 +298,11 @@ impl HeadlessProject {
|
||||||
|
|
||||||
fn on_lsp_store_event(
|
fn on_lsp_store_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
lsp_store: Entity<LspStore>,
|
_lsp_store: Entity<LspStore>,
|
||||||
event: &LspStoreEvent,
|
event: &LspStoreEvent,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
match event {
|
||||||
LspStoreEvent::LanguageServerAdded(id, name, worktree_id) => {
|
|
||||||
let log_store = cx
|
|
||||||
.try_global::<GlobalLogStore>()
|
|
||||||
.and_then(|lsp_logs| lsp_logs.0.upgrade());
|
|
||||||
if let Some(log_store) = log_store {
|
|
||||||
log_store.update(cx, |log_store, cx| {
|
|
||||||
log_store.add_language_server(
|
|
||||||
LanguageServerKind::LocalSsh {
|
|
||||||
lsp_store: self.lsp_store.downgrade(),
|
|
||||||
},
|
|
||||||
*id,
|
|
||||||
Some(name.clone()),
|
|
||||||
*worktree_id,
|
|
||||||
lsp_store.read(cx).language_server_for_id(*id),
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LspStoreEvent::LanguageServerRemoved(id) => {
|
|
||||||
let log_store = cx
|
|
||||||
.try_global::<GlobalLogStore>()
|
|
||||||
.and_then(|lsp_logs| lsp_logs.0.upgrade());
|
|
||||||
if let Some(log_store) = log_store {
|
|
||||||
log_store.update(cx, |log_store, cx| {
|
|
||||||
log_store.remove_language_server(*id, cx);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LspStoreEvent::LanguageServerUpdate {
|
LspStoreEvent::LanguageServerUpdate {
|
||||||
language_server_id,
|
language_server_id,
|
||||||
name,
|
name,
|
||||||
|
|
@ -359,6 +326,16 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
.log_err();
|
.log_err();
|
||||||
}
|
}
|
||||||
|
LspStoreEvent::LanguageServerLog(language_server_id, log_type, message) => {
|
||||||
|
self.session
|
||||||
|
.send(proto::LanguageServerLog {
|
||||||
|
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||||
|
language_server_id: language_server_id.to_proto(),
|
||||||
|
message: message.clone(),
|
||||||
|
log_type: Some(log_type.to_proto()),
|
||||||
|
})
|
||||||
|
.log_err();
|
||||||
|
}
|
||||||
LspStoreEvent::LanguageServerPrompt(prompt) => {
|
LspStoreEvent::LanguageServerPrompt(prompt) => {
|
||||||
let request = self.session.request(proto::LanguageServerPromptRequest {
|
let request = self.session.request(proto::LanguageServerPromptRequest {
|
||||||
project_id: REMOTE_SERVER_PROJECT_ID,
|
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||||
|
|
@ -532,31 +509,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_toggle_lsp_logs(
|
pub async fn handle_open_server_settings(
|
||||||
_: Entity<Self>,
|
|
||||||
envelope: TypedEnvelope<proto::ToggleLspLogs>,
|
|
||||||
mut cx: AsyncApp,
|
|
||||||
) -> Result<()> {
|
|
||||||
let server_id = LanguageServerId::from_proto(envelope.payload.server_id);
|
|
||||||
let lsp_logs = cx
|
|
||||||
.update(|cx| {
|
|
||||||
cx.try_global::<GlobalLogStore>()
|
|
||||||
.and_then(|lsp_logs| lsp_logs.0.upgrade())
|
|
||||||
})?
|
|
||||||
.context("lsp logs store is missing")?;
|
|
||||||
|
|
||||||
lsp_logs.update(&mut cx, |lsp_logs, _| {
|
|
||||||
// we do not support any other log toggling yet
|
|
||||||
if envelope.payload.enabled {
|
|
||||||
lsp_logs.enable_rpc_trace_for_language_server(server_id);
|
|
||||||
} else {
|
|
||||||
lsp_logs.disable_rpc_trace_for_language_server(server_id);
|
|
||||||
}
|
|
||||||
})?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn handle_open_server_settings(
|
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
_: TypedEnvelope<proto::OpenServerSettings>,
|
_: TypedEnvelope<proto::OpenServerSettings>,
|
||||||
mut cx: AsyncApp,
|
mut cx: AsyncApp,
|
||||||
|
|
@ -609,7 +562,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_find_search_candidates(
|
pub async fn handle_find_search_candidates(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::FindSearchCandidates>,
|
envelope: TypedEnvelope<proto::FindSearchCandidates>,
|
||||||
mut cx: AsyncApp,
|
mut cx: AsyncApp,
|
||||||
|
|
@ -641,7 +594,7 @@ impl HeadlessProject {
|
||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_list_remote_directory(
|
pub async fn handle_list_remote_directory(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::ListRemoteDirectory>,
|
envelope: TypedEnvelope<proto::ListRemoteDirectory>,
|
||||||
cx: AsyncApp,
|
cx: AsyncApp,
|
||||||
|
|
@ -673,7 +626,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_get_path_metadata(
|
pub async fn handle_get_path_metadata(
|
||||||
this: Entity<Self>,
|
this: Entity<Self>,
|
||||||
envelope: TypedEnvelope<proto::GetPathMetadata>,
|
envelope: TypedEnvelope<proto::GetPathMetadata>,
|
||||||
cx: AsyncApp,
|
cx: AsyncApp,
|
||||||
|
|
@ -691,7 +644,7 @@ impl HeadlessProject {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_shutdown_remote_server(
|
pub async fn handle_shutdown_remote_server(
|
||||||
_this: Entity<Self>,
|
_this: Entity<Self>,
|
||||||
_envelope: TypedEnvelope<proto::ShutdownRemoteServer>,
|
_envelope: TypedEnvelope<proto::ShutdownRemoteServer>,
|
||||||
cx: AsyncApp,
|
cx: AsyncApp,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ pub struct ActiveSettingsProfileName(pub String);
|
||||||
|
|
||||||
impl Global for ActiveSettingsProfileName {}
|
impl Global for ActiveSettingsProfileName {}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord, serde::Serialize)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)]
|
||||||
pub struct WorktreeId(usize);
|
pub struct WorktreeId(usize);
|
||||||
|
|
||||||
impl From<WorktreeId> for usize {
|
impl From<WorktreeId> for usize {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ path = "src/workspace.rs"
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["call"]
|
|
||||||
test-support = [
|
test-support = [
|
||||||
"call/test-support",
|
"call/test-support",
|
||||||
"client/test-support",
|
"client/test-support",
|
||||||
|
|
@ -30,7 +29,7 @@ test-support = [
|
||||||
any_vec.workspace = true
|
any_vec.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
async-recursion.workspace = true
|
async-recursion.workspace = true
|
||||||
call = { workspace = true, optional = true }
|
call.workspace = true
|
||||||
client.workspace = true
|
client.workspace = true
|
||||||
clock.workspace = true
|
clock.workspace = true
|
||||||
collections.workspace = true
|
collections.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,11 @@ use crate::{
|
||||||
workspace_settings::{PaneSplitDirectionHorizontal, PaneSplitDirectionVertical},
|
workspace_settings::{PaneSplitDirectionHorizontal, PaneSplitDirectionVertical},
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
use call::{ActiveCall, ParticipantLocation};
|
use call::{ActiveCall, ParticipantLocation};
|
||||||
|
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Along, AnyView, AnyWeakView, Axis, Bounds, Entity, Hsla, IntoElement, Pixels, Point,
|
Along, AnyView, AnyWeakView, Axis, Bounds, Entity, Hsla, IntoElement, MouseButton, Pixels,
|
||||||
StyleRefinement, WeakEntity, Window, point, size,
|
Point, StyleRefinement, WeakEntity, Window, point, size,
|
||||||
};
|
};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use project::Project;
|
use project::Project;
|
||||||
|
|
@ -200,7 +197,6 @@ pub enum Member {
|
||||||
pub struct PaneRenderContext<'a> {
|
pub struct PaneRenderContext<'a> {
|
||||||
pub project: &'a Entity<Project>,
|
pub project: &'a Entity<Project>,
|
||||||
pub follower_states: &'a HashMap<CollaboratorId, FollowerState>,
|
pub follower_states: &'a HashMap<CollaboratorId, FollowerState>,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub active_call: Option<&'a Entity<ActiveCall>>,
|
pub active_call: Option<&'a Entity<ActiveCall>>,
|
||||||
pub active_pane: &'a Entity<Pane>,
|
pub active_pane: &'a Entity<Pane>,
|
||||||
pub app_state: &'a Arc<AppState>,
|
pub app_state: &'a Arc<AppState>,
|
||||||
|
|
@ -262,11 +258,6 @@ impl PaneLeaderDecorator for PaneRenderContext<'_> {
|
||||||
let mut leader_color;
|
let mut leader_color;
|
||||||
let status_box;
|
let status_box;
|
||||||
match leader_id {
|
match leader_id {
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
CollaboratorId::PeerId(_) => {
|
|
||||||
return LeaderDecoration::default();
|
|
||||||
}
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
CollaboratorId::PeerId(peer_id) => {
|
CollaboratorId::PeerId(peer_id) => {
|
||||||
let Some(leader) = self.active_call.as_ref().and_then(|call| {
|
let Some(leader) = self.active_call.as_ref().and_then(|call| {
|
||||||
let room = call.read(cx).room()?.read(cx);
|
let room = call.read(cx).room()?.read(cx);
|
||||||
|
|
@ -324,7 +315,7 @@ impl PaneLeaderDecorator for PaneRenderContext<'_> {
|
||||||
|this, (leader_project_id, leader_user_id)| {
|
|this, (leader_project_id, leader_user_id)| {
|
||||||
let app_state = self.app_state.clone();
|
let app_state = self.app_state.clone();
|
||||||
this.cursor_pointer().on_mouse_down(
|
this.cursor_pointer().on_mouse_down(
|
||||||
gpui::MouseButton::Left,
|
MouseButton::Left,
|
||||||
move |_, _, cx| {
|
move |_, _, cx| {
|
||||||
crate::join_in_room_project(
|
crate::join_in_room_project(
|
||||||
leader_project_id,
|
leader_project_id,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ pub mod pane_group;
|
||||||
mod path_list;
|
mod path_list;
|
||||||
mod persistence;
|
mod persistence;
|
||||||
pub mod searchable;
|
pub mod searchable;
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub mod shared_screen;
|
pub mod shared_screen;
|
||||||
mod status_bar;
|
mod status_bar;
|
||||||
pub mod tasks;
|
pub mod tasks;
|
||||||
|
|
@ -23,17 +22,11 @@ pub use dock::Panel;
|
||||||
pub use path_list::PathList;
|
pub use path_list::PathList;
|
||||||
pub use toast_layer::{ToastAction, ToastLayer, ToastView};
|
pub use toast_layer::{ToastAction, ToastLayer, ToastView};
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
use call::{ActiveCall, call_settings::CallSettings};
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
use client::{Status, proto::ErrorCode};
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
use shared_screen::SharedScreen;
|
|
||||||
|
|
||||||
use anyhow::{Context as _, Result, anyhow};
|
use anyhow::{Context as _, Result, anyhow};
|
||||||
|
use call::{ActiveCall, call_settings::CallSettings};
|
||||||
use client::{
|
use client::{
|
||||||
ChannelId, Client, ErrorExt, TypedEnvelope, UserStore,
|
ChannelId, Client, ErrorExt, Status, TypedEnvelope, UserStore,
|
||||||
proto::{self, PanelId, PeerId},
|
proto::{self, ErrorCode, PanelId, PeerId},
|
||||||
};
|
};
|
||||||
use collections::{HashMap, HashSet, hash_map};
|
use collections::{HashMap, HashSet, hash_map};
|
||||||
use dock::{Dock, DockPosition, PanelButtons, PanelHandle, RESIZE_HANDLE_SIZE};
|
use dock::{Dock, DockPosition, PanelButtons, PanelHandle, RESIZE_HANDLE_SIZE};
|
||||||
|
|
@ -86,6 +79,7 @@ use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use session::AppSession;
|
use session::AppSession;
|
||||||
use settings::{Settings, update_settings_file};
|
use settings::{Settings, update_settings_file};
|
||||||
|
use shared_screen::SharedScreen;
|
||||||
use sqlez::{
|
use sqlez::{
|
||||||
bindable::{Bind, Column, StaticColumnCount},
|
bindable::{Bind, Column, StaticColumnCount},
|
||||||
statement::Statement,
|
statement::Statement,
|
||||||
|
|
@ -892,7 +886,6 @@ impl Global for GlobalAppState {}
|
||||||
|
|
||||||
pub struct WorkspaceStore {
|
pub struct WorkspaceStore {
|
||||||
workspaces: HashSet<WindowHandle<Workspace>>,
|
workspaces: HashSet<WindowHandle<Workspace>>,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
_subscriptions: Vec<client::Subscription>,
|
_subscriptions: Vec<client::Subscription>,
|
||||||
}
|
}
|
||||||
|
|
@ -1124,7 +1117,6 @@ pub struct Workspace {
|
||||||
window_edited: bool,
|
window_edited: bool,
|
||||||
last_window_title: Option<String>,
|
last_window_title: Option<String>,
|
||||||
dirty_items: HashMap<EntityId, Subscription>,
|
dirty_items: HashMap<EntityId, Subscription>,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
active_call: Option<(Entity<ActiveCall>, Vec<Subscription>)>,
|
active_call: Option<(Entity<ActiveCall>, Vec<Subscription>)>,
|
||||||
leader_updates_tx: mpsc::UnboundedSender<(PeerId, proto::UpdateFollowers)>,
|
leader_updates_tx: mpsc::UnboundedSender<(PeerId, proto::UpdateFollowers)>,
|
||||||
database_id: Option<WorkspaceId>,
|
database_id: Option<WorkspaceId>,
|
||||||
|
|
@ -1166,7 +1158,6 @@ pub struct FollowerState {
|
||||||
|
|
||||||
struct FollowerView {
|
struct FollowerView {
|
||||||
view: Box<dyn FollowableItemHandle>,
|
view: Box<dyn FollowableItemHandle>,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
location: Option<proto::PanelId>,
|
location: Option<proto::PanelId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1366,15 +1357,10 @@ impl Workspace {
|
||||||
|
|
||||||
let session_id = app_state.session.read(cx).id().to_owned();
|
let session_id = app_state.session.read(cx).id().to_owned();
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
let mut active_call = None;
|
let mut active_call = None;
|
||||||
#[cfg(feature = "call")]
|
if let Some(call) = ActiveCall::try_global(cx) {
|
||||||
{
|
let subscriptions = vec![cx.subscribe_in(&call, window, Self::on_active_call_event)];
|
||||||
if let Some(call) = ActiveCall::try_global(cx) {
|
active_call = Some((call, subscriptions));
|
||||||
let subscriptions =
|
|
||||||
vec![cx.subscribe_in(&call, window, Self::on_active_call_event)];
|
|
||||||
active_call = Some((call, subscriptions));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let (serializable_items_tx, serializable_items_rx) =
|
let (serializable_items_tx, serializable_items_rx) =
|
||||||
|
|
@ -1460,7 +1446,6 @@ impl Workspace {
|
||||||
window_edited: false,
|
window_edited: false,
|
||||||
last_window_title: None,
|
last_window_title: None,
|
||||||
dirty_items: Default::default(),
|
dirty_items: Default::default(),
|
||||||
#[cfg(feature = "call")]
|
|
||||||
active_call,
|
active_call,
|
||||||
database_id: workspace_id,
|
database_id: workspace_id,
|
||||||
app_state,
|
app_state,
|
||||||
|
|
@ -2265,7 +2250,6 @@ impl Workspace {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Task<Result<bool>> {
|
) -> Task<Result<bool>> {
|
||||||
#[cfg(feature = "call")]
|
|
||||||
let active_call = self.active_call().cloned();
|
let active_call = self.active_call().cloned();
|
||||||
|
|
||||||
// On Linux and Windows, closing the last window should restore the last workspace.
|
// On Linux and Windows, closing the last window should restore the last workspace.
|
||||||
|
|
@ -2274,58 +2258,51 @@ impl Workspace {
|
||||||
&& cx.windows().len() == 1;
|
&& cx.windows().len() == 1;
|
||||||
|
|
||||||
cx.spawn_in(window, async move |this, cx| {
|
cx.spawn_in(window, async move |this, cx| {
|
||||||
#[cfg(feature = "call")]
|
let workspace_count = cx.update(|_window, cx| {
|
||||||
{
|
cx.windows()
|
||||||
let workspace_count = cx.update(|_window, cx| {
|
.iter()
|
||||||
cx.windows()
|
.filter(|window| window.downcast::<Workspace>().is_some())
|
||||||
.iter()
|
.count()
|
||||||
.filter(|window| window.downcast::<Workspace>().is_some())
|
})?;
|
||||||
.count()
|
|
||||||
})?;
|
|
||||||
if let Some(active_call) = active_call
|
|
||||||
&& workspace_count == 1
|
|
||||||
&& active_call.read_with(cx, |call, _| call.room().is_some())?
|
|
||||||
{
|
|
||||||
if close_intent == CloseIntent::CloseWindow {
|
|
||||||
let answer = cx.update(|window, cx| {
|
|
||||||
window.prompt(
|
|
||||||
PromptLevel::Warning,
|
|
||||||
"Do you want to leave the current call?",
|
|
||||||
None,
|
|
||||||
&["Close window and hang up", "Cancel"],
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
if answer.await.log_err() == Some(1) {
|
if let Some(active_call) = active_call
|
||||||
return anyhow::Ok(false);
|
&& workspace_count == 1
|
||||||
} else {
|
&& active_call.read_with(cx, |call, _| call.room().is_some())?
|
||||||
{
|
{
|
||||||
active_call
|
if close_intent == CloseIntent::CloseWindow {
|
||||||
.update(cx, |call, cx| call.hang_up(cx))?
|
let answer = cx.update(|window, cx| {
|
||||||
.await
|
window.prompt(
|
||||||
.log_err();
|
PromptLevel::Warning,
|
||||||
}
|
"Do you want to leave the current call?",
|
||||||
}
|
None,
|
||||||
|
&["Close window and hang up", "Cancel"],
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
|
||||||
|
if answer.await.log_err() == Some(1) {
|
||||||
|
return anyhow::Ok(false);
|
||||||
|
} else {
|
||||||
|
active_call
|
||||||
|
.update(cx, |call, cx| call.hang_up(cx))?
|
||||||
|
.await
|
||||||
|
.log_err();
|
||||||
}
|
}
|
||||||
if close_intent == CloseIntent::ReplaceWindow {
|
}
|
||||||
#[cfg(feature = "call")]
|
if close_intent == CloseIntent::ReplaceWindow {
|
||||||
{
|
_ = active_call.update(cx, |this, cx| {
|
||||||
_ = active_call.update(cx, |active_call, cx| {
|
let workspace = cx
|
||||||
let workspace = cx
|
.windows()
|
||||||
.windows()
|
.iter()
|
||||||
.iter()
|
.filter_map(|window| window.downcast::<Workspace>())
|
||||||
.filter_map(|window| window.downcast::<Workspace>())
|
.next()
|
||||||
.next()
|
.unwrap();
|
||||||
.unwrap();
|
let project = workspace.read(cx)?.project.clone();
|
||||||
let project = workspace.read(cx)?.project.clone();
|
if project.read(cx).is_shared() {
|
||||||
if project.read(cx).is_shared() {
|
this.unshare_project(project, cx)?;
|
||||||
active_call.unshare_project(project, cx)?;
|
|
||||||
}
|
|
||||||
anyhow::Ok(())
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
}
|
Ok::<_, anyhow::Error>(())
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3509,7 +3486,6 @@ impl Workspace {
|
||||||
item
|
item
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn open_shared_screen(
|
pub fn open_shared_screen(
|
||||||
&mut self,
|
&mut self,
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
|
|
@ -3931,11 +3907,8 @@ impl Workspace {
|
||||||
pane.update(cx, |pane, _| {
|
pane.update(cx, |pane, _| {
|
||||||
pane.track_alternate_file_items();
|
pane.track_alternate_file_items();
|
||||||
});
|
});
|
||||||
#[cfg(feature = "call")]
|
if *local {
|
||||||
{
|
self.unfollow_in_pane(pane, window, cx);
|
||||||
if *local {
|
|
||||||
self.unfollow_in_pane(pane, window, cx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
serialize_workspace = *focus_changed || pane != self.active_pane();
|
serialize_workspace = *focus_changed || pane != self.active_pane();
|
||||||
if pane == self.active_pane() {
|
if pane == self.active_pane() {
|
||||||
|
|
@ -4000,17 +3973,6 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn unfollow_in_pane(
|
|
||||||
&mut self,
|
|
||||||
_pane: &Entity<Pane>,
|
|
||||||
_window: &mut Window,
|
|
||||||
_cx: &mut Context<Workspace>,
|
|
||||||
) -> Option<CollaboratorId> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn unfollow_in_pane(
|
pub fn unfollow_in_pane(
|
||||||
&mut self,
|
&mut self,
|
||||||
pane: &Entity<Pane>,
|
pane: &Entity<Pane>,
|
||||||
|
|
@ -4160,7 +4122,6 @@ impl Workspace {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn start_following(
|
pub fn start_following(
|
||||||
&mut self,
|
&mut self,
|
||||||
leader_id: impl Into<CollaboratorId>,
|
leader_id: impl Into<CollaboratorId>,
|
||||||
|
|
@ -4224,16 +4185,6 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn follow_next_collaborator(
|
|
||||||
&mut self,
|
|
||||||
_: &FollowNextCollaborator,
|
|
||||||
_window: &mut Window,
|
|
||||||
_cx: &mut Context<Self>,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn follow_next_collaborator(
|
pub fn follow_next_collaborator(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &FollowNextCollaborator,
|
_: &FollowNextCollaborator,
|
||||||
|
|
@ -4282,16 +4233,6 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn follow(
|
|
||||||
&mut self,
|
|
||||||
_leader_id: impl Into<CollaboratorId>,
|
|
||||||
_window: &mut Window,
|
|
||||||
_cx: &mut Context<Self>,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn follow(
|
pub fn follow(
|
||||||
&mut self,
|
&mut self,
|
||||||
leader_id: impl Into<CollaboratorId>,
|
leader_id: impl Into<CollaboratorId>,
|
||||||
|
|
@ -4344,17 +4285,6 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn unfollow(
|
|
||||||
&mut self,
|
|
||||||
_leader_id: impl Into<CollaboratorId>,
|
|
||||||
_window: &mut Window,
|
|
||||||
_cx: &mut Context<Self>,
|
|
||||||
) -> Option<()> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn unfollow(
|
pub fn unfollow(
|
||||||
&mut self,
|
&mut self,
|
||||||
leader_id: impl Into<CollaboratorId>,
|
leader_id: impl Into<CollaboratorId>,
|
||||||
|
|
@ -4665,7 +4595,6 @@ impl Workspace {
|
||||||
anyhow::bail!("no id for view");
|
anyhow::bail!("no id for view");
|
||||||
};
|
};
|
||||||
let id = ViewId::from_proto(id)?;
|
let id = ViewId::from_proto(id)?;
|
||||||
#[cfg(feature = "call")]
|
|
||||||
let panel_id = view.panel_id.and_then(proto::PanelId::from_i32);
|
let panel_id = view.panel_id.and_then(proto::PanelId::from_i32);
|
||||||
|
|
||||||
let pane = this.update(cx, |this, _cx| {
|
let pane = this.update(cx, |this, _cx| {
|
||||||
|
|
@ -4738,7 +4667,6 @@ impl Workspace {
|
||||||
id,
|
id,
|
||||||
FollowerView {
|
FollowerView {
|
||||||
view: item,
|
view: item,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
location: panel_id,
|
location: panel_id,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -4793,7 +4721,6 @@ impl Workspace {
|
||||||
view.map(|view| {
|
view.map(|view| {
|
||||||
entry.insert(FollowerView {
|
entry.insert(FollowerView {
|
||||||
view,
|
view,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
location: None,
|
location: None,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -4984,17 +4911,6 @@ impl Workspace {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
fn active_item_for_peer(
|
|
||||||
&self,
|
|
||||||
_peer_id: PeerId,
|
|
||||||
_window: &mut Window,
|
|
||||||
_cx: &mut Context<Self>,
|
|
||||||
) -> Option<(Option<PanelId>, Box<dyn ItemHandle>)> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
fn active_item_for_peer(
|
fn active_item_for_peer(
|
||||||
&self,
|
&self,
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
|
|
@ -5036,7 +4952,6 @@ impl Workspace {
|
||||||
item_to_activate
|
item_to_activate
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
fn shared_screen_for_peer(
|
fn shared_screen_for_peer(
|
||||||
&self,
|
&self,
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
|
|
@ -5087,12 +5002,10 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn active_call(&self) -> Option<&Entity<ActiveCall>> {
|
pub fn active_call(&self) -> Option<&Entity<ActiveCall>> {
|
||||||
self.active_call.as_ref().map(|(call, _)| call)
|
self.active_call.as_ref().map(|(call, _)| call)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
fn on_active_call_event(
|
fn on_active_call_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &Entity<ActiveCall>,
|
_: &Entity<ActiveCall>,
|
||||||
|
|
@ -6005,17 +5918,6 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
fn leader_border_for_pane(
|
|
||||||
_follower_states: &HashMap<CollaboratorId, FollowerState>,
|
|
||||||
_pane: &Entity<Pane>,
|
|
||||||
_: &Window,
|
|
||||||
_cx: &App,
|
|
||||||
) -> Option<Div> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
fn leader_border_for_pane(
|
fn leader_border_for_pane(
|
||||||
follower_states: &HashMap<CollaboratorId, FollowerState>,
|
follower_states: &HashMap<CollaboratorId, FollowerState>,
|
||||||
pane: &Entity<Pane>,
|
pane: &Entity<Pane>,
|
||||||
|
|
@ -6482,7 +6384,6 @@ impl Render for Workspace {
|
||||||
&PaneRenderContext {
|
&PaneRenderContext {
|
||||||
follower_states:
|
follower_states:
|
||||||
&self.follower_states,
|
&self.follower_states,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
active_call: self.active_call(),
|
active_call: self.active_call(),
|
||||||
active_pane: &self.active_pane,
|
active_pane: &self.active_pane,
|
||||||
app_state: &self.app_state,
|
app_state: &self.app_state,
|
||||||
|
|
@ -6547,7 +6448,6 @@ impl Render for Workspace {
|
||||||
&PaneRenderContext {
|
&PaneRenderContext {
|
||||||
follower_states:
|
follower_states:
|
||||||
&self.follower_states,
|
&self.follower_states,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
active_call: self.active_call(),
|
active_call: self.active_call(),
|
||||||
active_pane: &self.active_pane,
|
active_pane: &self.active_pane,
|
||||||
app_state: &self.app_state,
|
app_state: &self.app_state,
|
||||||
|
|
@ -6610,7 +6510,6 @@ impl Render for Workspace {
|
||||||
&PaneRenderContext {
|
&PaneRenderContext {
|
||||||
follower_states:
|
follower_states:
|
||||||
&self.follower_states,
|
&self.follower_states,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
active_call: self.active_call(),
|
active_call: self.active_call(),
|
||||||
active_pane: &self.active_pane,
|
active_pane: &self.active_pane,
|
||||||
app_state: &self.app_state,
|
app_state: &self.app_state,
|
||||||
|
|
@ -6659,7 +6558,6 @@ impl Render for Workspace {
|
||||||
&PaneRenderContext {
|
&PaneRenderContext {
|
||||||
follower_states:
|
follower_states:
|
||||||
&self.follower_states,
|
&self.follower_states,
|
||||||
#[cfg(feature = "call")]
|
|
||||||
active_call: self.active_call(),
|
active_call: self.active_call(),
|
||||||
active_pane: &self.active_pane,
|
active_pane: &self.active_pane,
|
||||||
app_state: &self.app_state,
|
app_state: &self.app_state,
|
||||||
|
|
@ -6733,22 +6631,10 @@ impl WorkspaceStore {
|
||||||
client.add_request_handler(cx.weak_entity(), Self::handle_follow),
|
client.add_request_handler(cx.weak_entity(), Self::handle_follow),
|
||||||
client.add_message_handler(cx.weak_entity(), Self::handle_update_followers),
|
client.add_message_handler(cx.weak_entity(), Self::handle_update_followers),
|
||||||
],
|
],
|
||||||
#[cfg(feature = "call")]
|
|
||||||
client,
|
client,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn update_followers(
|
|
||||||
&self,
|
|
||||||
_project_id: Option<u64>,
|
|
||||||
_update: proto::update_followers::Variant,
|
|
||||||
_cx: &App,
|
|
||||||
) -> Option<()> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn update_followers(
|
pub fn update_followers(
|
||||||
&self,
|
&self,
|
||||||
project_id: Option<u64>,
|
project_id: Option<u64>,
|
||||||
|
|
@ -6914,7 +6800,6 @@ actions!(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
async fn join_channel_internal(
|
async fn join_channel_internal(
|
||||||
channel_id: ChannelId,
|
channel_id: ChannelId,
|
||||||
app_state: &Arc<AppState>,
|
app_state: &Arc<AppState>,
|
||||||
|
|
@ -7062,17 +6947,6 @@ async fn join_channel_internal(
|
||||||
anyhow::Ok(false)
|
anyhow::Ok(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn join_channel(
|
|
||||||
_channel_id: ChannelId,
|
|
||||||
_app_state: Arc<AppState>,
|
|
||||||
_requesting_window: Option<WindowHandle<Workspace>>,
|
|
||||||
_cx: &mut App,
|
|
||||||
) -> Task<Result<()>> {
|
|
||||||
Task::ready(Ok(()))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn join_channel(
|
pub fn join_channel(
|
||||||
channel_id: ChannelId,
|
channel_id: ChannelId,
|
||||||
app_state: Arc<AppState>,
|
app_state: Arc<AppState>,
|
||||||
|
|
@ -7580,17 +7454,6 @@ fn serialize_ssh_project(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "call"))]
|
|
||||||
pub fn join_in_room_project(
|
|
||||||
_project_id: u64,
|
|
||||||
_follow_user_id: u64,
|
|
||||||
_app_state: Arc<AppState>,
|
|
||||||
_cx: &mut App,
|
|
||||||
) -> Task<Result<()>> {
|
|
||||||
Task::ready(Ok(()))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "call")]
|
|
||||||
pub fn join_in_room_project(
|
pub fn join_in_room_project(
|
||||||
project_id: u64,
|
project_id: u64,
|
||||||
follow_user_id: u64,
|
follow_user_id: u64,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue