Attempt to open new entry only if it is a file

This commit is contained in:
Antonio Scandurra 2022-06-14 14:01:49 +02:00
parent 572e295854
commit a5a4246e6c

View File

@ -410,6 +410,7 @@ impl ProjectPanel {
let worktree_id = edit_state.worktree_id; let worktree_id = edit_state.worktree_id;
let is_new_entry = edit_state.is_new_entry; let is_new_entry = edit_state.is_new_entry;
let is_dir = edit_state.is_dir;
let worktree = self.project.read(cx).worktree_for_id(worktree_id, cx)?; let worktree = self.project.read(cx).worktree_for_id(worktree_id, cx)?;
let entry = worktree.read(cx).entry_for_id(edit_state.entry_id)?.clone(); let entry = worktree.read(cx).entry_for_id(edit_state.entry_id)?.clone();
let filename = self.filename_editor.read(cx).text(cx); let filename = self.filename_editor.read(cx).text(cx);
@ -458,7 +459,7 @@ impl ProjectPanel {
} }
} }
this.update_visible_entries(None, cx); this.update_visible_entries(None, cx);
if is_new_entry { if is_new_entry && !is_dir {
this.open_entry( this.open_entry(
&Open { &Open {
entry_id: new_entry.id, entry_id: new_entry.id,