Show project panel symlink icons for remote clients (#19464)

This commit is contained in:
Kirill Bulatov 2024-10-19 19:44:47 +03:00 committed by GitHub
parent e8207288e5
commit 1ae30f5813
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 31 additions and 36 deletions

View file

@ -91,7 +91,6 @@ struct EditState {
entry_id: ProjectEntryId,
is_new_entry: bool,
is_dir: bool,
is_symlink: bool,
depth: usize,
processing_filename: Option<String>,
}
@ -987,7 +986,6 @@ impl ProjectPanel {
is_new_entry: true,
is_dir,
processing_filename: None,
is_symlink: false,
depth: 0,
});
self.filename_editor.update(cx, |editor, cx| {
@ -1027,7 +1025,6 @@ impl ProjectPanel {
is_new_entry: false,
is_dir: entry.is_dir(),
processing_filename: None,
is_symlink: entry.is_symlink,
depth: 0,
});
let file_name = entry
@ -1533,16 +1530,15 @@ impl ProjectPanel {
fn open_in_terminal(&mut self, _: &OpenInTerminal, cx: &mut ViewContext<Self>) {
if let Some((worktree, entry)) = self.selected_sub_entry(cx) {
let abs_path = worktree.abs_path().join(&entry.path);
let abs_path = match &entry.canonical_path {
Some(canonical_path) => Some(canonical_path.to_path_buf()),
None => worktree.absolutize(&entry.path).ok(),
};
let working_directory = if entry.is_dir() {
Some(abs_path)
abs_path
} else {
if entry.is_symlink {
abs_path.canonicalize().ok()
} else {
Some(abs_path)
}
.and_then(|path| Some(path.parent()?.to_path_buf()))
abs_path.and_then(|path| Some(path.parent()?.to_path_buf()))
};
if let Some(working_directory) = working_directory {
cx.dispatch_action(workspace::OpenTerminal { working_directory }.boxed_clone())
@ -1830,7 +1826,6 @@ impl ProjectPanel {
.unwrap_or_default();
if let Some(edit_state) = &mut self.edit_state {
if edit_state.entry_id == entry.id {
edit_state.is_symlink = entry.is_symlink;
edit_state.depth = depth;
}
}
@ -1861,7 +1856,6 @@ impl ProjectPanel {
is_private: false,
git_status: entry.git_status,
canonical_path: entry.canonical_path.clone(),
is_symlink: entry.is_symlink,
char_bag: entry.char_bag,
is_fifo: entry.is_fifo,
});
@ -1920,7 +1914,7 @@ impl ProjectPanel {
let width_estimate = item_width_estimate(
depth,
path.to_string_lossy().chars().count(),
entry.is_symlink,
entry.canonical_path.is_some(),
);
match max_width_item.as_mut() {