mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Start work on creating gpui2 version of project panel
This commit is contained in:
parent
6f23894b40
commit
b9e098ead8
31
Cargo.lock
generated
31
Cargo.lock
generated
@ -6587,6 +6587,36 @@ dependencies = [
|
|||||||
"workspace",
|
"workspace",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "project_panel2"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"client2",
|
||||||
|
"collections",
|
||||||
|
"context_menu",
|
||||||
|
"db2",
|
||||||
|
"editor2",
|
||||||
|
"futures 0.3.28",
|
||||||
|
"gpui2",
|
||||||
|
"language2",
|
||||||
|
"menu2",
|
||||||
|
"postage",
|
||||||
|
"pretty_assertions",
|
||||||
|
"project2",
|
||||||
|
"schemars",
|
||||||
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
|
"serde_json",
|
||||||
|
"settings2",
|
||||||
|
"smallvec",
|
||||||
|
"theme2",
|
||||||
|
"ui2",
|
||||||
|
"unicase",
|
||||||
|
"util",
|
||||||
|
"workspace2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "project_symbols"
|
name = "project_symbols"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -11394,6 +11424,7 @@ dependencies = [
|
|||||||
"parking_lot 0.11.2",
|
"parking_lot 0.11.2",
|
||||||
"postage",
|
"postage",
|
||||||
"project2",
|
"project2",
|
||||||
|
"project_panel2",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"regex",
|
"regex",
|
||||||
"rope2",
|
"rope2",
|
||||||
|
@ -79,6 +79,7 @@ members = [
|
|||||||
"crates/project",
|
"crates/project",
|
||||||
"crates/project2",
|
"crates/project2",
|
||||||
"crates/project_panel",
|
"crates/project_panel",
|
||||||
|
"crates/project_panel2",
|
||||||
"crates/project_symbols",
|
"crates/project_symbols",
|
||||||
"crates/recent_projects",
|
"crates/recent_projects",
|
||||||
"crates/rope",
|
"crates/rope",
|
||||||
|
41
crates/project_panel2/Cargo.toml
Normal file
41
crates/project_panel2/Cargo.toml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
[package]
|
||||||
|
name = "project_panel2"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "src/project_panel.rs"
|
||||||
|
doctest = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
context_menu = { path = "../context_menu" }
|
||||||
|
collections = { path = "../collections" }
|
||||||
|
db = { path = "../db2", package = "db2" }
|
||||||
|
editor = { path = "../editor2", package = "editor2" }
|
||||||
|
gpui = { path = "../gpui2", package = "gpui2" }
|
||||||
|
menu = { path = "../menu2", package = "menu2" }
|
||||||
|
project = { path = "../project2", package = "project2" }
|
||||||
|
settings = { path = "../settings2", package = "settings2" }
|
||||||
|
theme = { path = "../theme2", package = "theme2" }
|
||||||
|
ui = { path = "../ui2", package = "ui2" }
|
||||||
|
util = { path = "../util" }
|
||||||
|
workspace = { path = "../workspace2", package = "workspace2" }
|
||||||
|
anyhow.workspace = true
|
||||||
|
postage.workspace = true
|
||||||
|
futures.workspace = true
|
||||||
|
serde.workspace = true
|
||||||
|
serde_derive.workspace = true
|
||||||
|
serde_json.workspace = true
|
||||||
|
schemars.workspace = true
|
||||||
|
smallvec.workspace = true
|
||||||
|
pretty_assertions.workspace = true
|
||||||
|
unicase = "2.6"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
client = { path = "../client2", package = "client2", features = ["test-support"] }
|
||||||
|
language = { path = "../language2", package = "language2", features = ["test-support"] }
|
||||||
|
editor = { path = "../editor2", package = "editor2", features = ["test-support"] }
|
||||||
|
gpui = { path = "../gpui2", package = "gpui2", features = ["test-support"] }
|
||||||
|
workspace = { path = "../workspace2", package = "workspace2", features = ["test-support"] }
|
||||||
|
serde_json.workspace = true
|
96
crates/project_panel2/src/file_associations.rs
Normal file
96
crates/project_panel2/src/file_associations.rs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
use std::{path::Path, str, sync::Arc};
|
||||||
|
|
||||||
|
use collections::HashMap;
|
||||||
|
|
||||||
|
use gpui::{AppContext, AssetSource};
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
use util::{maybe, paths::PathExt};
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
struct TypeConfig {
|
||||||
|
icon: Arc<str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct FileAssociations {
|
||||||
|
suffixes: HashMap<String, String>,
|
||||||
|
types: HashMap<String, TypeConfig>,
|
||||||
|
}
|
||||||
|
|
||||||
|
const COLLAPSED_DIRECTORY_TYPE: &'static str = "collapsed_folder";
|
||||||
|
const EXPANDED_DIRECTORY_TYPE: &'static str = "expanded_folder";
|
||||||
|
const COLLAPSED_CHEVRON_TYPE: &'static str = "collapsed_chevron";
|
||||||
|
const EXPANDED_CHEVRON_TYPE: &'static str = "expanded_chevron";
|
||||||
|
pub const FILE_TYPES_ASSET: &'static str = "icons/file_icons/file_types.json";
|
||||||
|
|
||||||
|
pub fn init(assets: impl AssetSource, cx: &mut AppContext) {
|
||||||
|
cx.set_global(FileAssociations::new(assets))
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FileAssociations {
|
||||||
|
pub fn new(assets: impl AssetSource) -> Self {
|
||||||
|
assets
|
||||||
|
.load("icons/file_icons/file_types.json")
|
||||||
|
.and_then(|file| {
|
||||||
|
serde_json::from_str::<FileAssociations>(str::from_utf8(&file).unwrap())
|
||||||
|
.map_err(Into::into)
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|_| FileAssociations {
|
||||||
|
suffixes: HashMap::default(),
|
||||||
|
types: HashMap::default(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_icon(path: &Path, cx: &AppContext) -> Arc<str> {
|
||||||
|
maybe!({
|
||||||
|
let this = cx.has_global::<Self>().then(|| cx.global::<Self>())?;
|
||||||
|
|
||||||
|
// FIXME: Associate a type with the languages and have the file's langauge
|
||||||
|
// override these associations
|
||||||
|
maybe!({
|
||||||
|
let suffix = path.icon_suffix()?;
|
||||||
|
|
||||||
|
this.suffixes
|
||||||
|
.get(suffix)
|
||||||
|
.and_then(|type_str| this.types.get(type_str))
|
||||||
|
.map(|type_config| type_config.icon.clone())
|
||||||
|
})
|
||||||
|
.or_else(|| this.types.get("default").map(|config| config.icon.clone()))
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| Arc::from("".to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_folder_icon(expanded: bool, cx: &AppContext) -> Arc<str> {
|
||||||
|
maybe!({
|
||||||
|
let this = cx.has_global::<Self>().then(|| cx.global::<Self>())?;
|
||||||
|
|
||||||
|
let key = if expanded {
|
||||||
|
EXPANDED_DIRECTORY_TYPE
|
||||||
|
} else {
|
||||||
|
COLLAPSED_DIRECTORY_TYPE
|
||||||
|
};
|
||||||
|
|
||||||
|
this.types
|
||||||
|
.get(key)
|
||||||
|
.map(|type_config| type_config.icon.clone())
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| Arc::from("".to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_chevron_icon(expanded: bool, cx: &AppContext) -> Arc<str> {
|
||||||
|
maybe!({
|
||||||
|
let this = cx.has_global::<Self>().then(|| cx.global::<Self>())?;
|
||||||
|
|
||||||
|
let key = if expanded {
|
||||||
|
EXPANDED_CHEVRON_TYPE
|
||||||
|
} else {
|
||||||
|
COLLAPSED_CHEVRON_TYPE
|
||||||
|
};
|
||||||
|
|
||||||
|
this.types
|
||||||
|
.get(key)
|
||||||
|
.map(|type_config| type_config.icon.clone())
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| Arc::from("".to_string()))
|
||||||
|
}
|
||||||
|
}
|
2858
crates/project_panel2/src/project_panel.rs
Normal file
2858
crates/project_panel2/src/project_panel.rs
Normal file
File diff suppressed because it is too large
Load Diff
45
crates/project_panel2/src/project_panel_settings.rs
Normal file
45
crates/project_panel2/src/project_panel_settings.rs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
use anyhow;
|
||||||
|
use schemars::JsonSchema;
|
||||||
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
use settings::Settings;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum ProjectPanelDockPosition {
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct ProjectPanelSettings {
|
||||||
|
pub default_width: f32,
|
||||||
|
pub dock: ProjectPanelDockPosition,
|
||||||
|
pub file_icons: bool,
|
||||||
|
pub folder_icons: bool,
|
||||||
|
pub git_status: bool,
|
||||||
|
pub indent_size: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
||||||
|
pub struct ProjectPanelSettingsContent {
|
||||||
|
pub default_width: Option<f32>,
|
||||||
|
pub dock: Option<ProjectPanelDockPosition>,
|
||||||
|
pub file_icons: Option<bool>,
|
||||||
|
pub folder_icons: Option<bool>,
|
||||||
|
pub git_status: Option<bool>,
|
||||||
|
pub indent_size: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Settings for ProjectPanelSettings {
|
||||||
|
const KEY: Option<&'static str> = Some("project_panel");
|
||||||
|
|
||||||
|
type FileContent = ProjectPanelSettingsContent;
|
||||||
|
|
||||||
|
fn load(
|
||||||
|
default_value: &Self::FileContent,
|
||||||
|
user_values: &[&Self::FileContent],
|
||||||
|
_: &mut gpui::AppContext,
|
||||||
|
) -> anyhow::Result<Self> {
|
||||||
|
Self::load_via_json_merge(default_value, user_values)
|
||||||
|
}
|
||||||
|
}
|
@ -29,7 +29,7 @@ use client2::{
|
|||||||
Client, TypedEnvelope, UserStore,
|
Client, TypedEnvelope, UserStore,
|
||||||
};
|
};
|
||||||
use collections::{hash_map, HashMap, HashSet};
|
use collections::{hash_map, HashMap, HashSet};
|
||||||
use dock::{Dock, DockPosition, PanelButtons};
|
use dock::{Dock, DockPosition, Panel, PanelButtons, PanelHandle as _};
|
||||||
use futures::{
|
use futures::{
|
||||||
channel::{mpsc, oneshot},
|
channel::{mpsc, oneshot},
|
||||||
future::try_join_all,
|
future::try_join_all,
|
||||||
@ -937,108 +937,15 @@ impl Workspace {
|
|||||||
&self.right_dock
|
&self.right_dock
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>)
|
pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
|
||||||
// where
|
let dock = match panel.position(cx) {
|
||||||
// T::Event: std::fmt::Debug,
|
DockPosition::Left => &self.left_dock,
|
||||||
// {
|
DockPosition::Bottom => &self.bottom_dock,
|
||||||
// self.add_panel_with_extra_event_handler(panel, cx, |_, _, _, _| {})
|
DockPosition::Right => &self.right_dock,
|
||||||
// }
|
};
|
||||||
|
|
||||||
// pub fn add_panel_with_extra_event_handler<T: Panel, F>(
|
dock.update(cx, |dock, cx| dock.add_panel(panel, cx));
|
||||||
// &mut self,
|
}
|
||||||
// panel: View<T>,
|
|
||||||
// cx: &mut ViewContext<Self>,
|
|
||||||
// handler: F,
|
|
||||||
// ) where
|
|
||||||
// T::Event: std::fmt::Debug,
|
|
||||||
// F: Fn(&mut Self, &View<T>, &T::Event, &mut ViewContext<Self>) + 'static,
|
|
||||||
// {
|
|
||||||
// let dock = match panel.position(cx) {
|
|
||||||
// DockPosition::Left => &self.left_dock,
|
|
||||||
// DockPosition::Bottom => &self.bottom_dock,
|
|
||||||
// DockPosition::Right => &self.right_dock,
|
|
||||||
// };
|
|
||||||
|
|
||||||
// self.subscriptions.push(cx.subscribe(&panel, {
|
|
||||||
// let mut dock = dock.clone();
|
|
||||||
// let mut prev_position = panel.position(cx);
|
|
||||||
// move |this, panel, event, cx| {
|
|
||||||
// if T::should_change_position_on_event(event) {
|
|
||||||
// THIS HAS BEEN MOVED TO NORMAL EVENT EMISSION
|
|
||||||
// See: Dock::add_panel
|
|
||||||
//
|
|
||||||
// let new_position = panel.read(cx).position(cx);
|
|
||||||
// let mut was_visible = false;
|
|
||||||
// dock.update(cx, |dock, cx| {
|
|
||||||
// prev_position = new_position;
|
|
||||||
|
|
||||||
// was_visible = dock.is_open()
|
|
||||||
// && dock
|
|
||||||
// .visible_panel()
|
|
||||||
// .map_or(false, |active_panel| active_panel.id() == panel.id());
|
|
||||||
// dock.remove_panel(&panel, cx);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if panel.is_zoomed(cx) {
|
|
||||||
// this.zoomed_position = Some(new_position);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// dock = match panel.read(cx).position(cx) {
|
|
||||||
// DockPosition::Left => &this.left_dock,
|
|
||||||
// DockPosition::Bottom => &this.bottom_dock,
|
|
||||||
// DockPosition::Right => &this.right_dock,
|
|
||||||
// }
|
|
||||||
// .clone();
|
|
||||||
// dock.update(cx, |dock, cx| {
|
|
||||||
// dock.add_panel(panel.clone(), cx);
|
|
||||||
// if was_visible {
|
|
||||||
// dock.set_open(true, cx);
|
|
||||||
// dock.activate_panel(dock.panels_len() - 1, cx);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// } else if T::should_zoom_in_on_event(event) {
|
|
||||||
// THIS HAS BEEN MOVED TO NORMAL EVENT EMISSION
|
|
||||||
// See: Dock::add_panel
|
|
||||||
//
|
|
||||||
// dock.update(cx, |dock, cx| dock.set_panel_zoomed(&panel, true, cx));
|
|
||||||
// if !panel.has_focus(cx) {
|
|
||||||
// cx.focus(&panel);
|
|
||||||
// }
|
|
||||||
// this.zoomed = Some(panel.downgrade().into_any());
|
|
||||||
// this.zoomed_position = Some(panel.read(cx).position(cx));
|
|
||||||
// } else if T::should_zoom_out_on_event(event) {
|
|
||||||
// THIS HAS BEEN MOVED TO NORMAL EVENT EMISSION
|
|
||||||
// See: Dock::add_panel
|
|
||||||
//
|
|
||||||
// dock.update(cx, |dock, cx| dock.set_panel_zoomed(&panel, false, cx));
|
|
||||||
// if this.zoomed_position == Some(prev_position) {
|
|
||||||
// this.zoomed = None;
|
|
||||||
// this.zoomed_position = None;
|
|
||||||
// }
|
|
||||||
// cx.notify();
|
|
||||||
// } else if T::is_focus_event(event) {
|
|
||||||
// THIS HAS BEEN MOVED TO NORMAL EVENT EMISSION
|
|
||||||
// See: Dock::add_panel
|
|
||||||
//
|
|
||||||
// let position = panel.read(cx).position(cx);
|
|
||||||
// this.dismiss_zoomed_items_to_reveal(Some(position), cx);
|
|
||||||
// if panel.is_zoomed(cx) {
|
|
||||||
// this.zoomed = Some(panel.downgrade().into_any());
|
|
||||||
// this.zoomed_position = Some(position);
|
|
||||||
// } else {
|
|
||||||
// this.zoomed = None;
|
|
||||||
// this.zoomed_position = None;
|
|
||||||
// }
|
|
||||||
// this.update_active_view_for_followers(cx);
|
|
||||||
// cx.notify();
|
|
||||||
// } else {
|
|
||||||
// handler(this, &panel, event, cx)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }));
|
|
||||||
|
|
||||||
// dock.update(cx, |dock, cx| dock.add_panel(panel, cx));
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn status_bar(&self) -> &View<StatusBar> {
|
pub fn status_bar(&self) -> &View<StatusBar> {
|
||||||
&self.status_bar
|
&self.status_bar
|
||||||
@ -1727,42 +1634,42 @@ impl Workspace {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// pub fn toggle_dock(&mut self, dock_side: DockPosition, cx: &mut ViewContext<Self>) {
|
pub fn toggle_dock(&mut self, dock_side: DockPosition, cx: &mut ViewContext<Self>) {
|
||||||
// let dock = match dock_side {
|
let dock = match dock_side {
|
||||||
// DockPosition::Left => &self.left_dock,
|
DockPosition::Left => &self.left_dock,
|
||||||
// DockPosition::Bottom => &self.bottom_dock,
|
DockPosition::Bottom => &self.bottom_dock,
|
||||||
// DockPosition::Right => &self.right_dock,
|
DockPosition::Right => &self.right_dock,
|
||||||
// };
|
};
|
||||||
// let mut focus_center = false;
|
let mut focus_center = false;
|
||||||
// let mut reveal_dock = false;
|
let mut reveal_dock = false;
|
||||||
// dock.update(cx, |dock, cx| {
|
dock.update(cx, |dock, cx| {
|
||||||
// let other_is_zoomed = self.zoomed.is_some() && self.zoomed_position != Some(dock_side);
|
let other_is_zoomed = self.zoomed.is_some() && self.zoomed_position != Some(dock_side);
|
||||||
// let was_visible = dock.is_open() && !other_is_zoomed;
|
let was_visible = dock.is_open() && !other_is_zoomed;
|
||||||
// dock.set_open(!was_visible, cx);
|
dock.set_open(!was_visible, cx);
|
||||||
|
|
||||||
// if let Some(active_panel) = dock.active_panel() {
|
if let Some(active_panel) = dock.active_panel() {
|
||||||
// if was_visible {
|
if was_visible {
|
||||||
// if active_panel.has_focus(cx) {
|
if active_panel.has_focus(cx) {
|
||||||
// focus_center = true;
|
focus_center = true;
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// cx.focus(active_panel.as_any());
|
// cx.focus(active_panel.as_any());
|
||||||
// reveal_dock = true;
|
reveal_dock = true;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// if reveal_dock {
|
if reveal_dock {
|
||||||
// self.dismiss_zoomed_items_to_reveal(Some(dock_side), cx);
|
self.dismiss_zoomed_items_to_reveal(Some(dock_side), cx);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if focus_center {
|
if focus_center {
|
||||||
// cx.focus_self();
|
cx.focus(&self.focus_handle);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// cx.notify();
|
cx.notify();
|
||||||
// self.serialize_workspace(cx);
|
self.serialize_workspace(cx);
|
||||||
// }
|
}
|
||||||
|
|
||||||
pub fn close_all_docks(&mut self, cx: &mut ViewContext<Self>) {
|
pub fn close_all_docks(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
let docks = [&self.left_dock, &self.bottom_dock, &self.right_dock];
|
let docks = [&self.left_dock, &self.bottom_dock, &self.right_dock];
|
||||||
|
@ -55,7 +55,7 @@ node_runtime = { path = "../node_runtime" }
|
|||||||
# outline = { path = "../outline" }
|
# outline = { path = "../outline" }
|
||||||
# plugin_runtime = { path = "../plugin_runtime",optional = true }
|
# plugin_runtime = { path = "../plugin_runtime",optional = true }
|
||||||
project = { package = "project2", path = "../project2" }
|
project = { package = "project2", path = "../project2" }
|
||||||
# project_panel = { path = "../project_panel" }
|
project_panel = { package = "project_panel2", path = "../project_panel2" }
|
||||||
# project_symbols = { path = "../project_symbols" }
|
# project_symbols = { path = "../project_symbols" }
|
||||||
# quick_action_bar = { path = "../quick_action_bar" }
|
# quick_action_bar = { path = "../quick_action_bar" }
|
||||||
# recent_projects = { path = "../recent_projects" }
|
# recent_projects = { path = "../recent_projects" }
|
||||||
|
@ -191,7 +191,7 @@ fn main() {
|
|||||||
// file_finder::init(cx);
|
// file_finder::init(cx);
|
||||||
// outline::init(cx);
|
// outline::init(cx);
|
||||||
// project_symbols::init(cx);
|
// project_symbols::init(cx);
|
||||||
// project_panel::init(Assets, cx);
|
project_panel::init(Assets, cx);
|
||||||
// channel::init(&client, user_store.clone(), cx);
|
// channel::init(&client, user_store.clone(), cx);
|
||||||
// diagnostics::init(cx);
|
// diagnostics::init(cx);
|
||||||
// search::init(cx);
|
// search::init(cx);
|
||||||
|
@ -15,9 +15,10 @@ pub use only_instance::*;
|
|||||||
pub use open_listener::*;
|
pub use open_listener::*;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use project_panel::ProjectPanel;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use workspace::{AppState, Workspace};
|
use workspace::{dock::PanelHandle as _, AppState, Workspace};
|
||||||
|
|
||||||
pub fn build_window_options(
|
pub fn build_window_options(
|
||||||
bounds: Option<WindowBounds>,
|
bounds: Option<WindowBounds>,
|
||||||
@ -138,49 +139,38 @@ pub fn initialize_workspace(
|
|||||||
// }
|
// }
|
||||||
// false
|
// false
|
||||||
// });
|
// });
|
||||||
// })?;
|
})?;
|
||||||
|
|
||||||
// let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
|
let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
// let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
|
// let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
// let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
|
// let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
// let channels_panel =
|
// let channels_panel =
|
||||||
// collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
|
// collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
// let chat_panel =
|
// let chat_panel =
|
||||||
// collab_ui::chat_panel::ChatPanel::load(workspace_handle.clone(), cx.clone());
|
// collab_ui::chat_panel::ChatPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
// let notification_panel = collab_ui::notification_panel::NotificationPanel::load(
|
// let notification_panel = collab_ui::notification_panel::NotificationPanel::load(
|
||||||
// workspace_handle.clone(),
|
// workspace_handle.clone(),
|
||||||
// cx.clone(),
|
// cx.clone(),
|
||||||
// );
|
// );
|
||||||
// let (
|
let (
|
||||||
// project_panel,
|
project_panel,
|
||||||
// terminal_panel,
|
// terminal_panel,
|
||||||
// assistant_panel,
|
// assistant_panel,
|
||||||
// channels_panel,
|
// channels_panel,
|
||||||
// chat_panel,
|
// chat_panel,
|
||||||
// notification_panel,
|
// notification_panel,
|
||||||
// ) = futures::try_join!(
|
) = futures::try_join!(
|
||||||
// project_panel,
|
project_panel,
|
||||||
// terminal_panel,
|
// terminal_panel,
|
||||||
// assistant_panel,
|
// assistant_panel,
|
||||||
// channels_panel,
|
// channels_panel,
|
||||||
// chat_panel,
|
// chat_panel,
|
||||||
// notification_panel,
|
// notification_panel,
|
||||||
// )?;
|
)?;
|
||||||
// workspace_handle.update(&mut cx, |workspace, cx| {
|
|
||||||
// let project_panel_position = project_panel.position(cx);
|
workspace_handle.update(&mut cx, |workspace, cx| {
|
||||||
// workspace.add_panel_with_extra_event_handler(
|
let project_panel_position = project_panel.position(cx);
|
||||||
// project_panel,
|
workspace.add_panel(project_panel, cx);
|
||||||
// cx,
|
|
||||||
// |workspace, _, event, cx| match event {
|
|
||||||
// project_panel::Event::NewSearchInDirectory { dir_entry } => {
|
|
||||||
// search::ProjectSearchView::new_search_in_directory(workspace, dir_entry, cx)
|
|
||||||
// }
|
|
||||||
// project_panel::Event::ActivatePanel => {
|
|
||||||
// workspace.focus_panel::<ProjectPanel>(cx);
|
|
||||||
// }
|
|
||||||
// _ => {}
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// workspace.add_panel(terminal_panel, cx);
|
// workspace.add_panel(terminal_panel, cx);
|
||||||
// workspace.add_panel(assistant_panel, cx);
|
// workspace.add_panel(assistant_panel, cx);
|
||||||
// workspace.add_panel(channels_panel, cx);
|
// workspace.add_panel(channels_panel, cx);
|
||||||
@ -198,9 +188,9 @@ pub fn initialize_workspace(
|
|||||||
// .map_or(false, |entry| entry.is_dir())
|
// .map_or(false, |entry| entry.is_dir())
|
||||||
// })
|
// })
|
||||||
// {
|
// {
|
||||||
// workspace.toggle_dock(project_panel_position, cx);
|
workspace.toggle_dock(project_panel_position, cx);
|
||||||
// }
|
// }
|
||||||
// cx.focus_self();
|
// cx.focus_self();
|
||||||
})?;
|
})?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user