This reverts commit e7b3b8bf03
.
Release Notes:
- N/A
This commit is contained in:
parent
1086b282b8
commit
495612be2e
4 changed files with 96 additions and 233 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -5439,7 +5439,6 @@ dependencies = [
|
||||||
"panel",
|
"panel",
|
||||||
"picker",
|
"picker",
|
||||||
"postage",
|
"postage",
|
||||||
"pretty_assertions",
|
|
||||||
"project",
|
"project",
|
||||||
"schemars",
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -61,7 +61,6 @@ ctor.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
editor = { workspace = true, features = ["test-support"] }
|
editor = { workspace = true, features = ["test-support"] }
|
||||||
gpui = { workspace = true, features = ["test-support"] }
|
gpui = { workspace = true, features = ["test-support"] }
|
||||||
pretty_assertions.workspace = true
|
|
||||||
project = { workspace = true, features = ["test-support"] }
|
project = { workspace = true, features = ["test-support"] }
|
||||||
settings = { workspace = true, features = ["test-support"] }
|
settings = { workspace = true, features = ["test-support"] }
|
||||||
unindent.workspace = true
|
unindent.workspace = true
|
||||||
|
|
|
@ -18,14 +18,7 @@ use git::repository::{
|
||||||
};
|
};
|
||||||
use git::{repository::RepoPath, status::FileStatus, Commit, ToggleStaged};
|
use git::{repository::RepoPath, status::FileStatus, Commit, ToggleStaged};
|
||||||
use git::{RestoreTrackedFiles, StageAll, TrashUntrackedFiles, UnstageAll};
|
use git::{RestoreTrackedFiles, StageAll, TrashUntrackedFiles, UnstageAll};
|
||||||
use gpui::{
|
use gpui::*;
|
||||||
actions, anchored, deferred, hsla, percentage, point, uniform_list, Action, Animation,
|
|
||||||
AnimationExt as _, AnyView, BoxShadow, ClickEvent, Corner, DismissEvent, Entity, EventEmitter,
|
|
||||||
FocusHandle, Focusable, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior,
|
|
||||||
Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, Point, PromptLevel,
|
|
||||||
ScrollStrategy, Stateful, Subscription, Task, Transformation, UniformListScrollHandle,
|
|
||||||
WeakEntity,
|
|
||||||
};
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use language::{Buffer, File};
|
use language::{Buffer, File};
|
||||||
use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrevious};
|
use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrevious};
|
||||||
|
@ -42,7 +35,6 @@ use settings::Settings as _;
|
||||||
use smallvec::smallvec;
|
use smallvec::smallvec;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::path::Path;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::{collections::HashSet, sync::Arc, time::Duration, usize};
|
use std::{collections::HashSet, sync::Arc, time::Duration, usize};
|
||||||
use strum::{IntoEnumIterator, VariantNames};
|
use strum::{IntoEnumIterator, VariantNames};
|
||||||
|
@ -52,7 +44,6 @@ use ui::{
|
||||||
Scrollbar, ScrollbarState, Tooltip,
|
Scrollbar, ScrollbarState, Tooltip,
|
||||||
};
|
};
|
||||||
use util::{maybe, post_inc, ResultExt, TryFutureExt};
|
use util::{maybe, post_inc, ResultExt, TryFutureExt};
|
||||||
use workspace::AppState;
|
|
||||||
|
|
||||||
use workspace::{
|
use workspace::{
|
||||||
dock::{DockPosition, Panel, PanelEvent},
|
dock::{DockPosition, Panel, PanelEvent},
|
||||||
|
@ -72,12 +63,7 @@ actions!(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
fn prompt<T>(
|
fn prompt<T>(msg: &str, detail: Option<&str>, window: &mut Window, cx: &mut App) -> Task<Result<T>>
|
||||||
msg: &str,
|
|
||||||
detail: Option<&str>,
|
|
||||||
window: &mut Window,
|
|
||||||
cx: &mut App,
|
|
||||||
) -> Task<anyhow::Result<T>>
|
|
||||||
where
|
where
|
||||||
T: IntoEnumIterator + VariantNames + 'static,
|
T: IntoEnumIterator + VariantNames + 'static,
|
||||||
{
|
{
|
||||||
|
@ -179,7 +165,6 @@ impl GitListEntry {
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub struct GitStatusEntry {
|
pub struct GitStatusEntry {
|
||||||
pub(crate) repo_path: RepoPath,
|
pub(crate) repo_path: RepoPath,
|
||||||
pub(crate) worktree_path: Arc<Path>,
|
|
||||||
pub(crate) status: FileStatus,
|
pub(crate) status: FileStatus,
|
||||||
pub(crate) is_staged: Option<bool>,
|
pub(crate) is_staged: Option<bool>,
|
||||||
}
|
}
|
||||||
|
@ -277,94 +262,96 @@ pub(crate) fn commit_message_editor(
|
||||||
|
|
||||||
impl GitPanel {
|
impl GitPanel {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
workspace: Entity<Workspace>,
|
workspace: &mut Workspace,
|
||||||
project: Entity<Project>,
|
|
||||||
app_state: Arc<AppState>,
|
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Workspace>,
|
||||||
) -> Self {
|
) -> Entity<Self> {
|
||||||
let fs = app_state.fs.clone();
|
let fs = workspace.app_state().fs.clone();
|
||||||
|
let project = workspace.project().clone();
|
||||||
let git_store = project.read(cx).git_store().clone();
|
let git_store = project.read(cx).git_store().clone();
|
||||||
let active_repository = project.read(cx).active_repository(cx);
|
let active_repository = project.read(cx).active_repository(cx);
|
||||||
let workspace = workspace.downgrade();
|
let workspace = cx.entity().downgrade();
|
||||||
|
|
||||||
let focus_handle = cx.focus_handle();
|
cx.new(|cx| {
|
||||||
cx.on_focus(&focus_handle, window, Self::focus_in).detach();
|
let focus_handle = cx.focus_handle();
|
||||||
cx.on_focus_out(&focus_handle, window, |this, _, window, cx| {
|
cx.on_focus(&focus_handle, window, Self::focus_in).detach();
|
||||||
this.hide_scrollbar(window, cx);
|
cx.on_focus_out(&focus_handle, window, |this, _, window, cx| {
|
||||||
|
this.hide_scrollbar(window, cx);
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
|
||||||
|
// just to let us render a placeholder editor.
|
||||||
|
// Once the active git repo is set, this buffer will be replaced.
|
||||||
|
let temporary_buffer = cx.new(|cx| Buffer::local("", cx));
|
||||||
|
let commit_editor = cx.new(|cx| {
|
||||||
|
commit_message_editor(temporary_buffer, None, project.clone(), true, window, cx)
|
||||||
|
});
|
||||||
|
|
||||||
|
commit_editor.update(cx, |editor, cx| {
|
||||||
|
editor.clear(window, cx);
|
||||||
|
});
|
||||||
|
|
||||||
|
let scroll_handle = UniformListScrollHandle::new();
|
||||||
|
|
||||||
|
cx.subscribe_in(
|
||||||
|
&git_store,
|
||||||
|
window,
|
||||||
|
move |this, git_store, event, window, cx| match event {
|
||||||
|
GitEvent::FileSystemUpdated => {
|
||||||
|
this.schedule_update(false, window, cx);
|
||||||
|
}
|
||||||
|
GitEvent::ActiveRepositoryChanged | GitEvent::GitStateUpdated => {
|
||||||
|
this.active_repository = git_store.read(cx).active_repository();
|
||||||
|
this.schedule_update(true, window, cx);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.detach();
|
||||||
|
|
||||||
|
let scrollbar_state =
|
||||||
|
ScrollbarState::new(scroll_handle.clone()).parent_entity(&cx.entity());
|
||||||
|
|
||||||
|
let repository_selector =
|
||||||
|
cx.new(|cx| RepositorySelector::new(project.clone(), window, cx));
|
||||||
|
|
||||||
|
let mut git_panel = Self {
|
||||||
|
pending_remote_operations: Default::default(),
|
||||||
|
remote_operation_id: 0,
|
||||||
|
active_repository,
|
||||||
|
commit_editor,
|
||||||
|
suggested_commit_message: None,
|
||||||
|
conflicted_count: 0,
|
||||||
|
conflicted_staged_count: 0,
|
||||||
|
current_modifiers: window.modifiers(),
|
||||||
|
add_coauthors: true,
|
||||||
|
entries: Vec::new(),
|
||||||
|
focus_handle: cx.focus_handle(),
|
||||||
|
fs,
|
||||||
|
hide_scrollbar_task: None,
|
||||||
|
new_count: 0,
|
||||||
|
new_staged_count: 0,
|
||||||
|
pending: Vec::new(),
|
||||||
|
pending_commit: None,
|
||||||
|
pending_serialization: Task::ready(None),
|
||||||
|
project,
|
||||||
|
repository_selector,
|
||||||
|
scroll_handle,
|
||||||
|
scrollbar_state,
|
||||||
|
selected_entry: None,
|
||||||
|
marked_entries: Vec::new(),
|
||||||
|
show_scrollbar: false,
|
||||||
|
tracked_count: 0,
|
||||||
|
tracked_staged_count: 0,
|
||||||
|
update_visible_entries_task: Task::ready(()),
|
||||||
|
width: Some(px(360.)),
|
||||||
|
context_menu: None,
|
||||||
|
workspace,
|
||||||
|
modal_open: false,
|
||||||
|
};
|
||||||
|
git_panel.schedule_update(false, window, cx);
|
||||||
|
git_panel.show_scrollbar = git_panel.should_show_scrollbar(cx);
|
||||||
|
git_panel
|
||||||
})
|
})
|
||||||
.detach();
|
|
||||||
|
|
||||||
// just to let us render a placeholder editor.
|
|
||||||
// Once the active git repo is set, this buffer will be replaced.
|
|
||||||
let temporary_buffer = cx.new(|cx| Buffer::local("", cx));
|
|
||||||
let commit_editor = cx.new(|cx| {
|
|
||||||
commit_message_editor(temporary_buffer, None, project.clone(), true, window, cx)
|
|
||||||
});
|
|
||||||
|
|
||||||
commit_editor.update(cx, |editor, cx| {
|
|
||||||
editor.clear(window, cx);
|
|
||||||
});
|
|
||||||
|
|
||||||
let scroll_handle = UniformListScrollHandle::new();
|
|
||||||
|
|
||||||
cx.subscribe_in(
|
|
||||||
&git_store,
|
|
||||||
window,
|
|
||||||
move |this, git_store, event, window, cx| match event {
|
|
||||||
GitEvent::FileSystemUpdated => {
|
|
||||||
this.schedule_update(false, window, cx);
|
|
||||||
}
|
|
||||||
GitEvent::ActiveRepositoryChanged | GitEvent::GitStateUpdated => {
|
|
||||||
this.active_repository = git_store.read(cx).active_repository();
|
|
||||||
this.schedule_update(true, window, cx);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.detach();
|
|
||||||
|
|
||||||
let scrollbar_state =
|
|
||||||
ScrollbarState::new(scroll_handle.clone()).parent_entity(&cx.entity());
|
|
||||||
|
|
||||||
let repository_selector = cx.new(|cx| RepositorySelector::new(project.clone(), window, cx));
|
|
||||||
|
|
||||||
let mut git_panel = Self {
|
|
||||||
pending_remote_operations: Default::default(),
|
|
||||||
remote_operation_id: 0,
|
|
||||||
active_repository,
|
|
||||||
commit_editor,
|
|
||||||
suggested_commit_message: None,
|
|
||||||
conflicted_count: 0,
|
|
||||||
conflicted_staged_count: 0,
|
|
||||||
current_modifiers: window.modifiers(),
|
|
||||||
add_coauthors: true,
|
|
||||||
entries: Vec::new(),
|
|
||||||
focus_handle: cx.focus_handle(),
|
|
||||||
fs,
|
|
||||||
hide_scrollbar_task: None,
|
|
||||||
new_count: 0,
|
|
||||||
new_staged_count: 0,
|
|
||||||
pending: Vec::new(),
|
|
||||||
pending_commit: None,
|
|
||||||
pending_serialization: Task::ready(None),
|
|
||||||
project,
|
|
||||||
repository_selector,
|
|
||||||
scroll_handle,
|
|
||||||
scrollbar_state,
|
|
||||||
selected_entry: None,
|
|
||||||
marked_entries: Vec::new(),
|
|
||||||
show_scrollbar: false,
|
|
||||||
tracked_count: 0,
|
|
||||||
tracked_staged_count: 0,
|
|
||||||
update_visible_entries_task: Task::ready(()),
|
|
||||||
width: Some(px(360.)),
|
|
||||||
context_menu: None,
|
|
||||||
workspace,
|
|
||||||
modal_open: false,
|
|
||||||
};
|
|
||||||
git_panel.schedule_update(false, window, cx);
|
|
||||||
git_panel.show_scrollbar = git_panel.should_show_scrollbar(cx);
|
|
||||||
git_panel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn entry_by_path(&self, path: &RepoPath) -> Option<usize> {
|
pub fn entry_by_path(&self, path: &RepoPath) -> Option<usize> {
|
||||||
|
@ -1489,7 +1476,7 @@ impl GitPanel {
|
||||||
&mut self,
|
&mut self,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> impl Future<Output = anyhow::Result<Option<Remote>>> {
|
) -> impl Future<Output = Result<Option<Remote>>> {
|
||||||
let repo = self.active_repository.clone();
|
let repo = self.active_repository.clone();
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
let mut cx = window.to_async(cx);
|
let mut cx = window.to_async(cx);
|
||||||
|
@ -1726,8 +1713,10 @@ impl GitPanel {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// First pass - collect all paths
|
||||||
let repo = repo.read(cx);
|
let repo = repo.read(cx);
|
||||||
|
|
||||||
|
// Second pass - create entries with proper depth calculation
|
||||||
for entry in repo.status() {
|
for entry in repo.status() {
|
||||||
let is_conflict = repo.has_conflict(&entry.repo_path);
|
let is_conflict = repo.has_conflict(&entry.repo_path);
|
||||||
let is_new = entry.status.is_created();
|
let is_new = entry.status.is_created();
|
||||||
|
@ -1741,12 +1730,8 @@ impl GitPanel {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(worktree_path) = repo.repository_entry.unrelativize(&entry.repo_path) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let entry = GitStatusEntry {
|
let entry = GitStatusEntry {
|
||||||
repo_path: entry.repo_path.clone(),
|
repo_path: entry.repo_path.clone(),
|
||||||
worktree_path,
|
|
||||||
status: entry.status,
|
status: entry.status,
|
||||||
is_staged,
|
is_staged,
|
||||||
};
|
};
|
||||||
|
@ -2394,7 +2379,7 @@ impl GitPanel {
|
||||||
&self,
|
&self,
|
||||||
sha: &str,
|
sha: &str,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Task<anyhow::Result<CommitDetails>> {
|
) -> Task<Result<CommitDetails>> {
|
||||||
let Some(repo) = self.active_repository.clone() else {
|
let Some(repo) = self.active_repository.clone() else {
|
||||||
return Task::ready(Err(anyhow::anyhow!("no active repo")));
|
return Task::ready(Err(anyhow::anyhow!("no active repo")));
|
||||||
};
|
};
|
||||||
|
@ -2479,12 +2464,12 @@ impl GitPanel {
|
||||||
cx: &Context<Self>,
|
cx: &Context<Self>,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
let display_name = entry
|
let display_name = entry
|
||||||
.worktree_path
|
.repo_path
|
||||||
.file_name()
|
.file_name()
|
||||||
.map(|name| name.to_string_lossy().into_owned())
|
.map(|name| name.to_string_lossy().into_owned())
|
||||||
.unwrap_or_else(|| entry.worktree_path.to_string_lossy().into_owned());
|
.unwrap_or_else(|| entry.repo_path.to_string_lossy().into_owned());
|
||||||
|
|
||||||
let worktree_path = entry.worktree_path.clone();
|
let repo_path = entry.repo_path.clone();
|
||||||
let selected = self.selected_entry == Some(ix);
|
let selected = self.selected_entry == Some(ix);
|
||||||
let marked = self.marked_entries.contains(&ix);
|
let marked = self.marked_entries.contains(&ix);
|
||||||
let status_style = GitPanelSettings::get_global(cx).status_style;
|
let status_style = GitPanelSettings::get_global(cx).status_style;
|
||||||
|
@ -2655,7 +2640,7 @@ impl GitPanel {
|
||||||
h_flex()
|
h_flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
.overflow_hidden()
|
.overflow_hidden()
|
||||||
.when_some(worktree_path.parent(), |this, parent| {
|
.when_some(repo_path.parent(), |this, parent| {
|
||||||
let parent_str = parent.to_string_lossy();
|
let parent_str = parent.to_string_lossy();
|
||||||
if !parent_str.is_empty() {
|
if !parent_str.is_empty() {
|
||||||
this.child(
|
this.child(
|
||||||
|
@ -3703,119 +3688,3 @@ impl ComponentPreview for PanelRepoFooter {
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use git::status::StatusCode;
|
|
||||||
use gpui::TestAppContext;
|
|
||||||
use project::{FakeFs, WorktreeSettings};
|
|
||||||
use serde_json::json;
|
|
||||||
use settings::SettingsStore;
|
|
||||||
use theme::LoadThemes;
|
|
||||||
use util::path;
|
|
||||||
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
fn init_test(cx: &mut gpui::TestAppContext) {
|
|
||||||
if std::env::var("RUST_LOG").is_ok() {
|
|
||||||
env_logger::try_init().ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
cx.update(|cx| {
|
|
||||||
let settings_store = SettingsStore::test(cx);
|
|
||||||
cx.set_global(settings_store);
|
|
||||||
WorktreeSettings::register(cx);
|
|
||||||
workspace::init_settings(cx);
|
|
||||||
theme::init(LoadThemes::JustBase, cx);
|
|
||||||
language::init(cx);
|
|
||||||
editor::init(cx);
|
|
||||||
Project::init_settings(cx);
|
|
||||||
crate::init(cx);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#[gpui::test]
|
|
||||||
async fn test_entry_worktree_paths(cx: &mut TestAppContext) {
|
|
||||||
init_test(cx);
|
|
||||||
let fs = FakeFs::new(cx.background_executor.clone());
|
|
||||||
fs.insert_tree(
|
|
||||||
"/root",
|
|
||||||
json!({
|
|
||||||
"zed": {
|
|
||||||
".git": {},
|
|
||||||
"crates": {
|
|
||||||
"gpui": {
|
|
||||||
"gpui.rs": "fn main() {}"
|
|
||||||
},
|
|
||||||
"util": {
|
|
||||||
"util.rs": "fn do_it() {}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
fs.set_status_for_repo_via_git_operation(
|
|
||||||
Path::new("/root/zed/.git"),
|
|
||||||
&[
|
|
||||||
(
|
|
||||||
Path::new("crates/gpui/gpui.rs"),
|
|
||||||
StatusCode::Modified.worktree(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
Path::new("crates/util/util.rs"),
|
|
||||||
StatusCode::Modified.worktree(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
let project =
|
|
||||||
Project::test(fs.clone(), [path!("/root/zed/crates/gpui").as_ref()], cx).await;
|
|
||||||
let (workspace, cx) =
|
|
||||||
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
|
|
||||||
|
|
||||||
cx.read(|cx| {
|
|
||||||
project
|
|
||||||
.read(cx)
|
|
||||||
.worktrees(cx)
|
|
||||||
.nth(0)
|
|
||||||
.unwrap()
|
|
||||||
.read(cx)
|
|
||||||
.as_local()
|
|
||||||
.unwrap()
|
|
||||||
.scan_complete()
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
|
|
||||||
cx.executor().run_until_parked();
|
|
||||||
|
|
||||||
let app_state = workspace.update(cx, |workspace, _| workspace.app_state().clone());
|
|
||||||
let panel = cx.new_window_entity(|window, cx| {
|
|
||||||
GitPanel::new(workspace, project, app_state, window, cx)
|
|
||||||
});
|
|
||||||
|
|
||||||
let handle = cx.update_window_entity(&panel, |panel, window, cx| {
|
|
||||||
panel.schedule_update(false, window, cx);
|
|
||||||
std::mem::replace(&mut panel.update_visible_entries_task, Task::ready(()))
|
|
||||||
});
|
|
||||||
cx.executor().advance_clock(2 * UPDATE_DEBOUNCE);
|
|
||||||
handle.await;
|
|
||||||
|
|
||||||
let entries = panel.update(cx, |panel, _| panel.entries.clone());
|
|
||||||
pretty_assertions::assert_eq!(
|
|
||||||
entries,
|
|
||||||
[
|
|
||||||
GitListEntry::Header(GitHeaderEntry {
|
|
||||||
header: Section::Tracked
|
|
||||||
}),
|
|
||||||
GitListEntry::GitStatusEntry(GitStatusEntry {
|
|
||||||
repo_path: "crates/gpui/gpui.rs".into(),
|
|
||||||
worktree_path: Path::new("gpui.rs").into(),
|
|
||||||
status: StatusCode::Modified.worktree(),
|
|
||||||
is_staged: Some(false),
|
|
||||||
})
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ use editor::ProposedChangesEditorToolbar;
|
||||||
use editor::{scroll::Autoscroll, Editor, MultiBuffer};
|
use editor::{scroll::Autoscroll, Editor, MultiBuffer};
|
||||||
use feature_flags::{FeatureFlagAppExt, FeatureFlagViewExt, GitUiFeatureFlag};
|
use feature_flags::{FeatureFlagAppExt, FeatureFlagViewExt, GitUiFeatureFlag};
|
||||||
use futures::{channel::mpsc, select_biased, StreamExt};
|
use futures::{channel::mpsc, select_biased, StreamExt};
|
||||||
use git_ui::git_panel::GitPanel;
|
|
||||||
use git_ui::project_diff::ProjectDiffToolbar;
|
use git_ui::project_diff::ProjectDiffToolbar;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, point, px, Action, App, AppContext as _, AsyncApp, Context, DismissEvent, Element,
|
actions, point, px, Action, App, AppContext as _, AsyncApp, Context, DismissEvent, Element,
|
||||||
|
@ -430,10 +429,7 @@ fn initialize_panels(
|
||||||
workspace.add_panel(chat_panel, window, cx);
|
workspace.add_panel(chat_panel, window, cx);
|
||||||
workspace.add_panel(notification_panel, window, cx);
|
workspace.add_panel(notification_panel, window, cx);
|
||||||
cx.when_flag_enabled::<GitUiFeatureFlag>(window, |workspace, window, cx| {
|
cx.when_flag_enabled::<GitUiFeatureFlag>(window, |workspace, window, cx| {
|
||||||
let entity = cx.entity();
|
let git_panel = git_ui::git_panel::GitPanel::new(workspace, window, cx);
|
||||||
let project = workspace.project().clone();
|
|
||||||
let app_state = workspace.app_state().clone();
|
|
||||||
let git_panel = cx.new(|cx| GitPanel::new(entity, project, app_state, window, cx));
|
|
||||||
workspace.add_panel(git_panel, window, cx);
|
workspace.add_panel(git_panel, window, cx);
|
||||||
});
|
});
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue