mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
zed: Fix local files not opening with focus on remote workspaces (#56373)
Closes https://github.com/zed-industries/zed/issues/55554 Release Notes: - Fixed an issue where local settings files would not correctly open on remote workspaces --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
This commit is contained in:
parent
740b4241c0
commit
1107bc8b09
2 changed files with 20 additions and 11 deletions
|
|
@ -1290,11 +1290,17 @@ pub enum Event {
|
|||
WorktreeCreationChanged,
|
||||
}
|
||||
|
||||
/// Controls which types of items should be made visible in the project panel
|
||||
/// when opened.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum OpenVisible {
|
||||
/// Make all opened items visible (both files and directories).
|
||||
All,
|
||||
/// Don't make any opened items visible.
|
||||
None,
|
||||
/// Only make opened files visible, not directories.
|
||||
OnlyFiles,
|
||||
/// Only make opened directories visible, not files.
|
||||
OnlyDirectories,
|
||||
}
|
||||
|
||||
|
|
@ -2104,7 +2110,7 @@ impl Workspace {
|
|||
})
|
||||
.log_err();
|
||||
|
||||
if open_mode == OpenMode::NewWindow {
|
||||
if open_mode == OpenMode::NewWindow || open_mode == OpenMode::Activate {
|
||||
window
|
||||
.update(cx, |_, window, _cx| {
|
||||
window.activate_window();
|
||||
|
|
|
|||
|
|
@ -2356,12 +2356,12 @@ fn open_settings_file(
|
|||
cx: &mut Context<Workspace>,
|
||||
) {
|
||||
cx.spawn_in(window, async move |workspace, cx| {
|
||||
let (worktree_creation_task, settings_open_task) = workspace
|
||||
workspace
|
||||
.update_in(cx, |workspace, window, cx| {
|
||||
workspace.with_local_or_wsl_workspace(window, cx, move |workspace, window, cx| {
|
||||
let project = workspace.project().clone();
|
||||
|
||||
let worktree_creation_task = cx.spawn_in(window, async move |_, cx| {
|
||||
cx.spawn_in(window, async move |workspace, cx| {
|
||||
let config_dir = project
|
||||
.update(cx, |project, cx| {
|
||||
project.try_windows_path_to_wsl(paths::config_dir().as_path(), cx)
|
||||
|
|
@ -2376,20 +2376,23 @@ fn open_settings_file(
|
|||
// drag and drop from OS) still have their worktrees
|
||||
// released on file close, causing LSP servers'
|
||||
// restarts.
|
||||
project
|
||||
let (_worktree, _) = project
|
||||
.update(cx, |project, cx| {
|
||||
project.find_or_create_worktree(&config_dir, false, cx)
|
||||
})
|
||||
.await
|
||||
});
|
||||
let settings_open_task =
|
||||
create_and_open_local_file(abs_path, window, cx, default_content);
|
||||
(worktree_creation_task, settings_open_task)
|
||||
.await?;
|
||||
|
||||
workspace
|
||||
.update_in(cx, |_, window, cx| {
|
||||
create_and_open_local_file(abs_path, window, cx, default_content)
|
||||
})?
|
||||
.await?;
|
||||
anyhow::Ok(())
|
||||
})
|
||||
})
|
||||
})?
|
||||
.await?
|
||||
.await?;
|
||||
let _ = worktree_creation_task.await?;
|
||||
let _ = settings_open_task.await?;
|
||||
anyhow::Ok(())
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue