linux: Show warning if file picker portal is missing (#14401)
This PR adds a warning when the file chooser couldn't be opened on Linux It's quite confusing when trying to open a file and apparently nothing happens: fixes https://github.com/zed-industries/zed/issues/11089, https://github.com/zed-industries/zed/issues/14328, https://github.com/zed-industries/zed/issues/13753#issuecomment-2225812703, https://github.com/zed-industries/zed/issues/13766, https://github.com/zed-industries/zed/issues/14384, https://github.com/zed-industries/zed/issues/14353, https://github.com/zed-industries/zed/issues/9209  Release Notes: - N/A
This commit is contained in:
parent
5d860e2286
commit
f3ddd18201
11 changed files with 248 additions and 75 deletions
|
@ -12,7 +12,7 @@ use editor::{Editor, EditorElement, EditorStyle};
|
|||
use extension::{ExtensionManifest, ExtensionOperation, ExtensionStore};
|
||||
use fuzzy::{match_strings, StringMatchCandidate};
|
||||
use gpui::{
|
||||
actions, uniform_list, AnyElement, AppContext, EventEmitter, FocusableView, FontStyle,
|
||||
actions, uniform_list, AnyElement, AppContext, EventEmitter, Flatten, FocusableView, FontStyle,
|
||||
InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle,
|
||||
UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext,
|
||||
};
|
||||
|
@ -24,7 +24,6 @@ use std::time::Duration;
|
|||
use std::{ops::Range, sync::Arc};
|
||||
use theme::ThemeSettings;
|
||||
use ui::{prelude::*, ContextMenu, PopoverMenu, ToggleButton, Tooltip};
|
||||
use util::ResultExt as _;
|
||||
use workspace::item::TabContentParams;
|
||||
use workspace::{
|
||||
item::{Item, ItemEvent},
|
||||
|
@ -58,9 +57,23 @@ pub fn init(cx: &mut AppContext) {
|
|||
multiple: false,
|
||||
});
|
||||
|
||||
let workspace_handle = cx.view().downgrade();
|
||||
cx.deref_mut()
|
||||
.spawn(|mut cx| async move {
|
||||
let extension_path = prompt.await.log_err()??.pop()?;
|
||||
let extension_path =
|
||||
match Flatten::flatten(prompt.await.map_err(|e| e.into())) {
|
||||
Ok(Some(mut paths)) => paths.pop()?,
|
||||
Ok(None) => return None,
|
||||
Err(err) => {
|
||||
workspace_handle
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
workspace.show_portal_error(err.to_string(), cx);
|
||||
})
|
||||
.ok();
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
store
|
||||
.update(&mut cx, |store, cx| {
|
||||
store
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue