mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Extract project_panel
into its own crate
This commit is contained in:
parent
499616d769
commit
d04a11405c
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -3733,6 +3733,18 @@ dependencies = [
|
||||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "project_panel"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"gpui",
|
||||
"postage",
|
||||
"project",
|
||||
"serde_json 1.0.64",
|
||||
"theme",
|
||||
"workspace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
version = "0.8.0"
|
||||
@ -6113,6 +6125,7 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"postage",
|
||||
"project",
|
||||
"project_panel",
|
||||
"rand 0.8.3",
|
||||
"rpc",
|
||||
"rsa",
|
||||
|
14
crates/project_panel/Cargo.toml
Normal file
14
crates/project_panel/Cargo.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "project_panel"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
gpui = { path = "../gpui" }
|
||||
project = { path = "../project" }
|
||||
theme = { path = "../theme" }
|
||||
workspace = { path = "../workspace" }
|
||||
postage = { version = "0.4.1", features = ["futures-traits"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
@ -1,8 +1,3 @@
|
||||
use crate::{
|
||||
project::{self, Project, ProjectEntry, ProjectPath},
|
||||
workspace::Workspace,
|
||||
Settings,
|
||||
};
|
||||
use gpui::{
|
||||
action,
|
||||
elements::{
|
||||
@ -19,12 +14,13 @@ use gpui::{
|
||||
ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use postage::watch;
|
||||
use project::Worktree;
|
||||
use project::{Project, ProjectEntry, ProjectPath, Worktree};
|
||||
use std::{
|
||||
collections::{hash_map, HashMap},
|
||||
ffi::OsStr,
|
||||
ops::Range,
|
||||
};
|
||||
use workspace::{Settings, Workspace};
|
||||
|
||||
pub struct ProjectPanel {
|
||||
project: ModelHandle<Project>,
|
||||
@ -575,17 +571,16 @@ impl Entity for ProjectPanel {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::test::test_app_state;
|
||||
use gpui::{TestAppContext, ViewHandle};
|
||||
use serde_json::json;
|
||||
use std::{collections::HashSet, path::Path};
|
||||
use workspace::WorkspaceParams;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_visible_list(mut cx: gpui::TestAppContext) {
|
||||
let app_state = cx.update(test_app_state);
|
||||
let settings = app_state.settings.clone();
|
||||
let fs = app_state.fs.as_fake();
|
||||
|
||||
let params = cx.update(WorkspaceParams::test);
|
||||
let settings = params.settings.clone();
|
||||
let fs = params.fs.as_fake();
|
||||
fs.insert_tree(
|
||||
"/root1",
|
||||
json!({
|
||||
@ -624,9 +619,9 @@ mod tests {
|
||||
|
||||
let project = cx.add_model(|_| {
|
||||
Project::new(
|
||||
app_state.languages.clone(),
|
||||
app_state.client.clone(),
|
||||
app_state.fs.clone(),
|
||||
params.languages.clone(),
|
||||
params.client.clone(),
|
||||
params.fs.clone(),
|
||||
)
|
||||
});
|
||||
let root1 = project
|
||||
@ -648,7 +643,7 @@ mod tests {
|
||||
.read_with(&cx, |t, _| t.as_local().unwrap().scan_complete())
|
||||
.await;
|
||||
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(&app_state.as_ref().into(), cx));
|
||||
let (_, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx));
|
||||
let panel = workspace.update(&mut cx, |_, cx| ProjectPanel::new(project, settings, cx));
|
||||
assert_eq!(
|
||||
visible_entry_details(&panel, 0..50, &mut cx),
|
@ -32,6 +32,7 @@ fuzzy = { path = "../fuzzy" }
|
||||
editor = { path = "../editor" }
|
||||
gpui = { path = "../gpui" }
|
||||
project = { path = "../project" }
|
||||
project_panel = { path = "../project_panel" }
|
||||
rpc = { path = "../rpc" }
|
||||
sum_tree = { path = "../sum_tree" }
|
||||
theme = { path = "../theme" }
|
||||
|
@ -4,7 +4,6 @@ pub mod file_finder;
|
||||
pub mod language;
|
||||
pub mod menus;
|
||||
pub mod people_panel;
|
||||
pub mod project_panel;
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub mod test;
|
||||
pub mod theme_selector;
|
||||
|
@ -16,7 +16,7 @@ use zed::{
|
||||
client::{http, ChannelList, UserStore},
|
||||
editor, file_finder,
|
||||
fs::RealFs,
|
||||
language, menus, people_panel, project_panel, theme_selector, AppState, OpenParams, OpenPaths,
|
||||
language, menus, people_panel, theme_selector, AppState, OpenParams, OpenPaths,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user