mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 06:05:19 +00:00
Change folder styling from a reduce over all child files to a simple 'always modified'
Remove git status from tab titles
This commit is contained in:
parent
17f138906e
commit
2b18975cdc
2 changed files with 10 additions and 38 deletions
|
@ -14,7 +14,7 @@ use language::{
|
|||
proto::serialize_anchor as serialize_text_anchor, Bias, Buffer, OffsetRangeExt, Point,
|
||||
SelectionGoal,
|
||||
};
|
||||
use project::{repository::GitFileStatus, FormatTrigger, Item as _, Project, ProjectPath};
|
||||
use project::{FormatTrigger, Item as _, Project, ProjectPath};
|
||||
use rpc::proto::{self, update_view};
|
||||
use settings::Settings;
|
||||
use smallvec::SmallVec;
|
||||
|
@ -27,7 +27,6 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
};
|
||||
use text::Selection;
|
||||
use theme::ui::FileName;
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use workspace::item::{BreadcrumbText, FollowableItemHandle};
|
||||
use workspace::{
|
||||
|
@ -566,25 +565,8 @@ impl Item for Editor {
|
|||
style: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> AnyElement<T> {
|
||||
fn git_file_status(this: &Editor, cx: &AppContext) -> Option<GitFileStatus> {
|
||||
let project_entry_id = this
|
||||
.buffer()
|
||||
.read(cx)
|
||||
.as_singleton()?
|
||||
.read(cx)
|
||||
.entry_id(cx)?;
|
||||
let project = this.project.as_ref()?.read(cx);
|
||||
let path = project.path_for_entry(project_entry_id, cx)?.path;
|
||||
let worktree = project.worktree_for_entry(project_entry_id, cx)?.read(cx);
|
||||
worktree.repo_for(&path)?.status_for_path(&worktree, &path)
|
||||
}
|
||||
|
||||
Flex::row()
|
||||
.with_child(ComponentHost::new(FileName::new(
|
||||
self.title(cx).to_string(),
|
||||
git_file_status(self, cx),
|
||||
FileName::style(style.label.clone(), &cx.global::<Settings>().theme),
|
||||
)))
|
||||
.with_child(Label::new(self.title(cx).to_string(), style.label.clone()).into_any())
|
||||
.with_children(detail.and_then(|detail| {
|
||||
let path = path_for_buffer(&self.buffer, detail, false, cx)?;
|
||||
let description = path.to_string_lossy();
|
||||
|
|
|
@ -55,7 +55,7 @@ use std::{
|
|||
time::{Duration, SystemTime},
|
||||
};
|
||||
use sum_tree::{Bias, Edit, SeekTarget, SumTree, TreeMap, TreeSet};
|
||||
use util::{paths::HOME, ResultExt, TakeUntilExt, TryFutureExt};
|
||||
use util::{paths::HOME, ResultExt, TryFutureExt};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)]
|
||||
pub struct WorktreeId(usize);
|
||||
|
@ -187,20 +187,12 @@ impl RepositoryEntry {
|
|||
self.worktree_statuses
|
||||
.iter_from(&repo_path)
|
||||
.take_while(|(key, _)| key.starts_with(&repo_path))
|
||||
.map(|(_, status)| status)
|
||||
// Short circut once we've found the highest level
|
||||
.take_until(|status| status == &&GitFileStatus::Conflict)
|
||||
.reduce(
|
||||
|status_first, status_second| match (status_first, status_second) {
|
||||
(GitFileStatus::Conflict, _) | (_, GitFileStatus::Conflict) => {
|
||||
&GitFileStatus::Conflict
|
||||
}
|
||||
(GitFileStatus::Modified, _) | (_, GitFileStatus::Modified) => {
|
||||
&GitFileStatus::Modified
|
||||
}
|
||||
_ => &GitFileStatus::Added,
|
||||
},
|
||||
)
|
||||
.map(|(path, status)| if path == &repo_path {
|
||||
status
|
||||
} else {
|
||||
&GitFileStatus::Modified
|
||||
})
|
||||
.next()
|
||||
.copied()
|
||||
})
|
||||
}
|
||||
|
@ -4170,15 +4162,13 @@ mod tests {
|
|||
|
||||
tree.flush_fs_events(cx).await;
|
||||
|
||||
dbg!(git_status(&repo));
|
||||
git_status(&repo);
|
||||
|
||||
// Check that non-repo behavior is tracked
|
||||
tree.read_with(cx, |tree, _cx| {
|
||||
let snapshot = tree.snapshot();
|
||||
let (_, repo) = snapshot.repository_entries.iter().next().unwrap();
|
||||
|
||||
dbg!(&repo.worktree_statuses);
|
||||
|
||||
assert_eq!(repo.worktree_statuses.iter().count(), 0);
|
||||
assert_eq!(repo.worktree_statuses.get(&Path::new(A_TXT).into()), None);
|
||||
assert_eq!(repo.worktree_statuses.get(&Path::new(B_TXT).into()), None);
|
||||
|
|
Loading…
Reference in a new issue