mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-25 03:16:01 +00:00
Improve delete prompt in project browser
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
6021ab12c9
commit
2e9bdfbeac
1 changed files with 8 additions and 1 deletions
|
@ -464,7 +464,14 @@ impl ProjectPanel {
|
|||
|
||||
fn delete(&mut self, _: &Delete, cx: &mut ViewContext<Self>) -> Option<Task<Result<()>>> {
|
||||
let Selection { entry_id, .. } = self.selection?;
|
||||
let mut answer = cx.prompt(PromptLevel::Info, "Delete?", &["Delete", "Cancel"]);
|
||||
let path = self.project.read(cx).path_for_entry(entry_id, cx)?.path;
|
||||
let file_name = path.file_name()?;
|
||||
|
||||
let mut answer = cx.prompt(
|
||||
PromptLevel::Info,
|
||||
&format!("Delete {file_name:?}?"),
|
||||
&["Delete", "Cancel"],
|
||||
);
|
||||
Some(cx.spawn(|this, mut cx| async move {
|
||||
if answer.next().await != Some(0) {
|
||||
return Ok(());
|
||||
|
|
Loading…
Reference in a new issue