cli: Use --wait to prefer focused window (#41051)
Introduce a new `prefer_focused_window` field to the `workspace::OpenOptions` struct that, when provided, will make it so that Zed opens the provided path in the currently focused window. This will now automatically be set to true when the `--wait` flag is used with the CLI. Closes #40551 Release Notes: - Improved the `--wait` flag in Zed's CLI so as to always open the provided file in the currently focused window --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
@@ -7323,6 +7323,7 @@ pub struct OpenOptions {
|
||||
pub visible: Option<OpenVisible>,
|
||||
pub focus: Option<bool>,
|
||||
pub open_new_workspace: Option<bool>,
|
||||
pub prefer_focused_window: bool,
|
||||
pub replace_window: Option<WindowHandle<Workspace>>,
|
||||
pub env: Option<HashMap<String, String>>,
|
||||
}
|
||||
@@ -7379,7 +7380,7 @@ pub fn open_paths(
|
||||
})?;
|
||||
|
||||
if open_options.open_new_workspace.is_none()
|
||||
&& existing.is_none()
|
||||
&& (existing.is_none() || open_options.prefer_focused_window)
|
||||
&& all_metadatas.iter().all(|file| !file.is_dir)
|
||||
{
|
||||
cx.update(|cx| {
|
||||
|
||||
Reference in New Issue
Block a user