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<()>>> {
|
fn delete(&mut self, _: &Delete, cx: &mut ViewContext<Self>) -> Option<Task<Result<()>>> {
|
||||||
let Selection { entry_id, .. } = self.selection?;
|
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 {
|
Some(cx.spawn(|this, mut cx| async move {
|
||||||
if answer.next().await != Some(0) {
|
if answer.next().await != Some(0) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue