Show error alert when there's an error opening file with native OS picker (#22671)

spotikhanov created

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):
https://github.com/zed-industries/zed/blob/de08e47e5bc94afdee81fd99f838100fc577a98c/crates/workspace/src/pane.rs#L2810

Release Notes:

- Added an error alert when there's an error opening file with native OS
picker.

Change summary

crates/workspace/src/workspace.rs | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)

Detailed changes

crates/workspace/src/workspace.rs 🔗

@@ -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(