Don't show "add/remove folder to/from project" for remote projects

This commit is contained in:
Antonio Scandurra 2022-05-31 08:17:52 +02:00
parent 1eb03f2f4e
commit e4641da598

View file

@ -242,15 +242,17 @@ impl ProjectPanel {
if let Some((worktree, entry)) = self.selected_entry(cx) {
let is_root = Some(entry) == worktree.root_entry();
menu_entries.push(ContextMenuItem::item(
"Add Folder to Project",
workspace::AddFolderToProject,
));
if is_root {
if !self.project.read(cx).is_remote() {
menu_entries.push(ContextMenuItem::item(
"Remove Folder from Project",
workspace::RemoveFolderFromProject(worktree_id),
"Add Folder to Project",
workspace::AddFolderToProject,
));
if is_root {
menu_entries.push(ContextMenuItem::item(
"Remove Folder from Project",
workspace::RemoveFolderFromProject(worktree_id),
));
}
}
menu_entries.push(ContextMenuItem::item("New File", AddFile));
menu_entries.push(ContextMenuItem::item("New Folder", AddDirectory));