Show error alert when there's an error opening file with native OS picker (#22671)
Closes #20814 by showing error alert if there's some error after OS
native File -> Open
https://github.com/user-attachments/assets/ce092831-4b55-4e20-8ffa-8e60eaf6364d
The implementation here is the same as in handle_external_paths_drop
function (when users uses drag and drop to open the file):
de08e47e5b/crates/workspace/src/pane.rs (L2810)
Release Notes:
- Added an error alert when there's an error opening file with native OS
picker.
This commit is contained in:
parent
dc0075b8e6
commit
410b4bded1
1 changed files with 16 additions and 9 deletions
|
@ -5553,15 +5553,22 @@ pub fn open_paths(
|
|||
}
|
||||
|
||||
if let Some(existing) = existing {
|
||||
Ok((
|
||||
existing,
|
||||
existing
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
cx.activate_window();
|
||||
workspace.open_paths(abs_paths, open_visible, None, cx)
|
||||
})?
|
||||
.await,
|
||||
))
|
||||
let open_task = existing
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
cx.activate_window();
|
||||
workspace.open_paths(abs_paths, open_visible, None, cx)
|
||||
})?
|
||||
.await;
|
||||
|
||||
_ = existing.update(&mut cx, |workspace, cx| {
|
||||
for item in open_task.iter().flatten() {
|
||||
if let Err(e) = item {
|
||||
workspace.show_error(&e, cx);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ok((existing, open_task))
|
||||
} else {
|
||||
cx.update(move |cx| {
|
||||
Workspace::new_local(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue