Merge branch 'main' into project-panel2

This commit is contained in:
Max Brunsfeld
2023-11-14 09:33:48 -08:00
65 changed files with 9847 additions and 8976 deletions
+18 -6
View File
@@ -1401,20 +1401,32 @@ impl Pane {
// .on_drop(|_view, state: View<DraggedTab>, cx| {
// eprintln!("{:?}", state.read(cx));
// })
.px_2()
.py_0p5()
.flex()
.items_center()
.justify_center()
// todo!("Nate - I need to do some work to balance all the items in the tab once things stablize")
.map(|this| {
if close_right {
this.pl_3().pr_1()
} else {
this.pr_1().pr_3()
}
})
.py_1()
.bg(tab_bg)
.hover(|h| h.bg(tab_hover_bg))
.active(|a| a.bg(tab_active_bg))
.border_color(cx.theme().colors().border)
.map(|this| match ix.cmp(&self.active_item_index) {
cmp::Ordering::Less => this.border_l(),
cmp::Ordering::Equal => this.border_r(),
cmp::Ordering::Greater => this.border_l().border_r(),
})
// .hover(|h| h.bg(tab_hover_bg))
// .active(|a| a.bg(tab_active_bg))
.child(
div()
.px_1()
.flex()
.items_center()
.gap_1p5()
.gap_1()
.text_color(text_color)
.children(if item.has_conflict(cx) {
Some(
+63 -60
View File
@@ -1130,53 +1130,56 @@ impl Workspace {
// }))
// }
// pub fn prepare_to_close(
// &mut self,
// quitting: bool,
// cx: &mut ViewContext<Self>,
// ) -> Task<Result<bool>> {
// let active_call = self.active_call().cloned();
// let window = cx.window();
pub fn prepare_to_close(
&mut self,
quitting: bool,
cx: &mut ViewContext<Self>,
) -> Task<Result<bool>> {
//todo!(saveing)
// let active_call = self.active_call().cloned();
// let window = cx.window();
// cx.spawn(|this, mut cx| async move {
// let workspace_count = cx
// .windows()
// .into_iter()
// .filter(|window| window.root_is::<Workspace>())
// .count();
cx.spawn(|this, mut cx| async move {
// let workspace_count = cx
// .windows()
// .into_iter()
// .filter(|window| window.root_is::<Workspace>())
// .count();
// if let Some(active_call) = active_call {
// if !quitting
// && workspace_count == 1
// && active_call.read_with(&cx, |call, _| call.room().is_some())
// {
// let answer = window.prompt(
// PromptLevel::Warning,
// "Do you want to leave the current call?",
// &["Close window and hang up", "Cancel"],
// &mut cx,
// );
// if let Some(active_call) = active_call {
// if !quitting
// && workspace_count == 1
// && active_call.read_with(&cx, |call, _| call.room().is_some())
// {
// let answer = window.prompt(
// PromptLevel::Warning,
// "Do you want to leave the current call?",
// &["Close window and hang up", "Cancel"],
// &mut cx,
// );
// if let Some(mut answer) = answer {
// if answer.next().await == Some(1) {
// return anyhow::Ok(false);
// } else {
// active_call
// .update(&mut cx, |call, cx| call.hang_up(cx))
// .await
// .log_err();
// }
// }
// }
// }
// if let Some(mut answer) = answer {
// if answer.next().await == Some(1) {
// return anyhow::Ok(false);
// } else {
// active_call
// .update(&mut cx, |call, cx| call.hang_up(cx))
// .await
// .log_err();
// }
// }
// }
// }
// Ok(this
// .update(&mut cx, |this, cx| {
// this.save_all_internal(SaveIntent::Close, cx)
// })?
// .await?)
// })
// }
Ok(
false, // this
// .update(&mut cx, |this, cx| {
// this.save_all_internal(SaveIntent::Close, cx)
// })?
// .await?
)
})
}
// fn save_all(
// &mut self,
@@ -4062,24 +4065,24 @@ impl ViewId {
}
}
// pub trait WorkspaceHandle {
// fn file_project_paths(&self, cx: &AppContext) -> Vec<ProjectPath>;
// }
pub trait WorkspaceHandle {
fn file_project_paths(&self, cx: &AppContext) -> Vec<ProjectPath>;
}
// impl WorkspaceHandle for View<Workspace> {
// fn file_project_paths(&self, cx: &AppContext) -> Vec<ProjectPath> {
// self.read(cx)
// .worktrees(cx)
// .flat_map(|worktree| {
// let worktree_id = worktree.read(cx).id();
// worktree.read(cx).files(true, 0).map(move |f| ProjectPath {
// worktree_id,
// path: f.path.clone(),
// })
// })
// .collect::<Vec<_>>()
// }
// }
impl WorkspaceHandle for View<Workspace> {
fn file_project_paths(&self, cx: &AppContext) -> Vec<ProjectPath> {
self.read(cx)
.worktrees(cx)
.flat_map(|worktree| {
let worktree_id = worktree.read(cx).id();
worktree.read(cx).files(true, 0).map(move |f| ProjectPath {
worktree_id,
path: f.path.clone(),
})
})
.collect::<Vec<_>>()
}
}
// impl std::fmt::Debug for OpenPaths {
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {