feat: show repository changes in normal file pickers

This commit is contained in:
2026-10-13 21:10:20 +02:00
parent e90d1c3945
commit 9526876b04
12 changed files with 2169 additions and 33 deletions
+26 -1
View File
@@ -1351,6 +1351,7 @@ pub struct DocumentInfo<'a> {
pub path: Option<&'a Path>,
pub lines: &'a [String],
pub save_revision: u64,
pub dirty: bool,
}
struct AnnotationSet {
@@ -1674,6 +1675,7 @@ impl Buffer {
.or(self.path.as_deref()),
lines: &self.lines,
save_revision: self.save_revision,
dirty: self.dirty(),
}
}
@@ -4693,6 +4695,29 @@ impl Editor {
}
}
pub(crate) fn normal_file_picker(&self) -> Option<&FilePicker> {
self.file_picker.as_ref().filter(|_| self.diff.is_none())
}
pub(crate) fn set_picker_repository_changes(
&mut self,
tab: usize,
root: &Path,
changes: Vec<crate::repository::WorkingFileChange>,
) -> bool {
let picker = if tab == self.tab_id {
self.file_picker.as_mut().filter(|_| self.diff.is_none())
} else {
self.tabs
.get_mut(&tab)
.and_then(|tab| tab.file_picker.as_mut().filter(|_| tab.diff.is_none()))
};
let Some(picker) = picker.filter(|picker| picker.root == root) else {
return false;
};
picker.set_repository_changes(changes)
}
pub fn file_explorer_side(&self) -> DockSide {
self.file_explorer_side
}
@@ -10485,7 +10510,7 @@ fn lsp_navigation_position(
Ok(TextPosition { row, column })
}
fn path_identity(path: &Path) -> io::Result<PathBuf> {
pub(crate) fn path_identity(path: &Path) -> io::Result<PathBuf> {
let absolute = if path.is_absolute() {
path.to_owned()
} else {